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

33 lines
627 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)
{
2020-01-19 00:07:08 +00:00
$file = File::create($request->only(['data','iid']));
return response()->json($file, 201);
2019-12-24 12:52:10 +00:00
}
public function delete($id)
{
File::findOrFail($id)->delete();
return response('Deleted Successfully', 200);
}
}