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

32 lines
627 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->only(['data','iid']));
return response()->json($file, 201);
}
public function delete($id)
{
File::findOrFail($id)->delete();
return response('Deleted Successfully', 200);
}
}