fanatic/app/Http/Controllers/JoinedController.php

51 lines
1.2 KiB
PHP
Raw Normal View History

2022-04-23 16:25:16 -07:00
<?php
namespace App\Http\Controllers;
use App\Http\Requests\StoreJoinedRequest;
use App\Http\Requests\UpdateJoinedRequest;
use App\Models\Joined;
class JoinedController extends Controller
{
2022-04-26 12:34:38 -07:00
public function __construct()
{
$this->authorizeResource(Joined::class, 'joined');
}
2022-04-23 16:25:16 -07:00
public function index()
{
2022-04-25 19:50:01 -07:00
return view('admin.joined.index');
2022-04-23 16:25:16 -07:00
}
public function create()
{
2022-04-26 12:34:38 -07:00
return view('admin.joined.create');
2022-04-23 16:25:16 -07:00
}
public function store(StoreJoinedRequest $request)
{
2022-04-26 18:43:36 -07:00
Joined::store($request->validated());
2022-04-26 12:34:38 -07:00
return redirect()->route('admin.joined.index')->with('success', 'Fanlisting added.');
2022-04-23 16:25:16 -07:00
}
public function edit(Joined $joined)
{
2022-04-26 12:34:38 -07:00
return view('admin.joined.edit')->with('joined', $joined);
2022-04-23 16:25:16 -07:00
}
public function update(UpdateJoinedRequest $request, Joined $joined)
{
2022-04-26 18:43:36 -07:00
$joined->patch($request->validated());
return redirect()->route('admin.joined.index')->with('success', 'Fanlisting updated.');
2022-04-23 16:25:16 -07:00
}
public function destroy(Joined $joined)
{
2022-04-26 19:13:53 -07:00
$joined->remove();
return redirect()->route('admin.joined.index')->with('success', 'Fanlisting removed.');
2022-04-23 16:25:16 -07:00
}
}