You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
846 B
36 lines
846 B
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Http\Resources\CollectionResource;
|
|
use App\Models\Collection;
|
|
use Illuminate\Http\Request;
|
|
|
|
class CollectionController extends Controller
|
|
{
|
|
|
|
public function show(Collection $collection)
|
|
{
|
|
return new CollectionResource($collection);
|
|
}
|
|
|
|
public function store(Request $request)
|
|
{
|
|
$collection = Collection::create($request->all());
|
|
return new CollectionResource($collection);
|
|
}
|
|
|
|
public function update(Request $request, Collection $collection)
|
|
{
|
|
$collection->update($request->all());
|
|
return new CollectionResource($collection);
|
|
}
|
|
|
|
public function destroy(Collection $collection)
|
|
{
|
|
if ($collection->trashed()) {
|
|
return $collection->restore();
|
|
}
|
|
return $collection->delete();
|
|
}
|
|
}
|