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

46 lines
976 B
PHP
Raw Permalink Normal View History

2019-11-15 21:15:58 +00:00
<?php
namespace App\Http\Controllers;
use App\Container;
use Illuminate\Http\Request;
2019-11-23 01:41:39 +00:00
/**
* @group Container management
*
* APIs for creating, deleting, updating and viewing containers
*/
2019-11-15 21:15:58 +00:00
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);
}
}