Skip to content
Discussion options

You must be logged in to vote
<?php

namespace App\Http\Controllers;

use App\Models\ClassSchool;
use App\Pipelines\FilterBySearch;
use Illuminate\Pipeline\Pipeline;

class ClassesController extends Controller
{
    public function __construct(protected Pipeline $pipeline)
    {
-        $this->authorizeResource(ClassSchool::class);
+        $this->authorizeResource(ClassSchool::class, 'class');
    }

-    public function destroy(ClassSchool $classes)
+    public function destroy(ClassSchool $class)
    {
-        $classes->delete();
+        $class->delete();

        return redirect()->back()->with('warning', __('classes.flash-warning'));
    }
}

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
3 replies
@MagnusDot
Comment options

@antimech
Comment options

Answer selected by MagnusDot
@MagnusDot
Comment options

Comment options

You must be logged in to vote
1 reply
@antimech
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #49023 on November 16, 2023 15:00.