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

41 lines
870 B
PHP
Raw Normal View History

2019-11-15 21:15:58 +00:00
<?php
namespace App\Http\Controllers;
use App\Container;
use Illuminate\Http\Request;
class ContainerController extends Controller
{
public function showAllContainers()
{
return response()->json(Container::all());
}
public function showOneContainer($id)
{
return response()->json(Container::find($id));
}
public function create(Request $request)
{
$container = Container::create($request->all());
return response()->json($container, 201);
}
public function update($id, Request $request)
{
$container = Container::findOrFail($id);
$container->update($request->all());
return response()->json($container, 200);
}
public function delete($id)
{
Container::findOrFail($id)->delete();
return response('Deleted Successfully', 200);
}
}