Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe
2024-07-04 22:52:49 +01:00
parent a1eafc108d
commit d3b62aa918
4 changed files with 65 additions and 160 deletions
@@ -6,6 +6,8 @@ use App\Helpers\Helper;
use App\Models\Statuslabel;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Http\RedirectResponse;
use \Illuminate\Contracts\View\View;
/**
* This controller handles all actions related to Status Labels for
@@ -17,18 +19,14 @@ class StatuslabelsController extends Controller
{
/**
* Show a list of all the statuslabels.
*
* @return \Illuminate\Contracts\View\View
* @throws \Illuminate\Auth\Access\AuthorizationException
*/
public function index()
public function index() : View
{
$this->authorize('view', Statuslabel::class);
return view('statuslabels.index');
}
public function show($id)
public function show($id) : View | RedirectResponse
{
$this->authorize('view', Statuslabel::class);
if ($statuslabel = Statuslabel::find($id)) {
@@ -41,10 +39,8 @@ class StatuslabelsController extends Controller
/**
* Statuslabel create.
*
* @return \Illuminate\Contracts\View\View
* @throws \Illuminate\Auth\Access\AuthorizationException
*/
public function create()
public function create() : View
{
// Show the page
$this->authorize('create', Statuslabel::class);
@@ -58,10 +54,8 @@ class StatuslabelsController extends Controller
* Statuslabel create form processing.
*
* @param Request $request
* @return \Illuminate\Http\RedirectResponse
* @throws \Illuminate\Auth\Access\AuthorizationException
*/
public function store(Request $request)
public function store(Request $request) : RedirectResponse
{
$this->authorize('create', Statuslabel::class);
// create a new model instance
@@ -96,10 +90,8 @@ class StatuslabelsController extends Controller
* Statuslabel update.
*
* @param int $statuslabelId
* @return \Illuminate\Contracts\View\View | \Illuminate\Http\RedirectResponse
* @throws \Illuminate\Auth\Access\AuthorizationException
*/
public function edit($statuslabelId = null)
public function edit($statuslabelId = null) : View | RedirectResponse
{
$this->authorize('update', Statuslabel::class);
// Check if the Statuslabel exists
@@ -119,10 +111,8 @@ class StatuslabelsController extends Controller
* Statuslabel update form processing page.
*
* @param int $statuslabelId
* @return \Illuminate\Http\RedirectResponse
* @throws \Illuminate\Auth\Access\AuthorizationException
*/
public function update(Request $request, $statuslabelId = null)
public function update(Request $request, $statuslabelId = null) : RedirectResponse
{
$this->authorize('update', Statuslabel::class);
// Check if the Statuslabel exists
@@ -159,10 +149,8 @@ class StatuslabelsController extends Controller
* Delete the given Statuslabel.
*
* @param int $statuslabelId
* @return \Illuminate\Http\RedirectResponse
* @throws \Illuminate\Auth\Access\AuthorizationException
*/
public function destroy($statuslabelId)
public function destroy($statuslabelId) : RedirectResponse
{
$this->authorize('delete', Statuslabel::class);
// Check if the Statuslabel exists