c3lf-system-3/app/Http/Controllers/FileController.php
2019-12-24 13:52:10 +01:00

41 lines
801 B
PHP

<?php
namespace App\Http\Controllers;
use App\File;
use Illuminate\Http\Request;
class FileController extends Controller
{
public function showAllFiles()
{
return response()->json(File::all());
}
public function showOneFile($id)
{
return response()->json(File::find($id));
}
public function create(Request $request)
{
$File = File::create($request->all());
return response()->json($File, 201);
}
public function update($id, Request $request)
{
$File = File::findOrFail($id);
$File->update($request->all());
return response()->json($File, 200);
}
public function delete($id)
{
File::findOrFail($id)->delete();
return response('Deleted Successfully', 200);
}
}