app/Http/Controllers/StudentController.php
/**
     * Show the form for editing the specified resource.
     *
     * @param  \App\Student  $student
     * @return \Illuminate\Http\Response
     */
Show the form for editing the specified resource.
Show the form for editing the specified resource .
public function edit(Student  $student, $slug)
    {
        $model = Student::where('slug', $slug)->first();
        if ($model == null) {
            return redirect()->route('student');
        }
        $response = Gate::inspect('update', $model);
        if (!$response->allowed()) {
            session()->flash('permission', $response->message());
            return redirect()->route('student');
        }
        return view('student.edit', ['item' => $model, 'classes' => Classes::all()]);
    }
public function edit ( Student $ student , $ slug ) { $ model = Student :: where ( 'slug' , $ slug ) -> first ( ) ; if ( $ model == null ) { return redirect ( ) -> route ( 'student' ) ; } $ response = Gate :: inspect ( 'update' , $ model ) ; if ( ! $ response -> allowed ( ) ) { session ( ) -> flash ( 'permission' , $ response -> message ( ) ) ; return redirect ( ) -> route ( 'student' ) ; } return view ( 'student.edit' , [ 'item' => $ model , 'classes' => Classes :: all ( ) ] ) ; }
Show the form for editing the specified resource.
Show the form for editing the specified resource .
/**
         * if the item has been removed
         */