c3lf-system-3/app/Http/Controllers/FileController.php

42 lines
801 B
PHP
Raw Normal View History

2019-12-24 12:52:10 +00:00
<?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);
}
}