Add controller and table for marking

This commit is contained in:
Too
2018-06-20 00:38:32 +08:00
parent 95f4f25dd3
commit 3f2d9fbfb8
6 changed files with 141 additions and 19 deletions
@@ -0,0 +1,40 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Marking;
class MarkingController extends Controller
{
public function index()
{
return Marking::all();
}
public function show(Marking $marking)
{
return $marking;
}
public function store(Request $request)
{
$marking = Marking::create($request->all());
return response()->json($marking, 201);
}
public function update(Request $request, Marking $marking)
{
$marking->update($request->all());
return response()->json($marking, 200);
}
public function delete(Marking $marking)
{
$marking->delete();
return response()->json(null, 204);
}
}