app/Http/Controllers/StudentController.php
/**
     * Remove the specified resource from storage.
     *
     * @param  \App\Student  $student
     * @return \Illuminate\Http\Response
     */
Remove the specified resource from storage.
Remove the specified resource from storage .
public function destroy(Student $student, $slug)
    {
        $model = Student::where('slug', $slug)->first();
        if ($model == null) {
            return redirect()->route('student');
        }
        $response = Gate::inspect('delete', $model);
        if (!$response->allowed()) {
            session()->flash('permission', $response->message());
            return redirect()->route('student');
        }
        session()->flash('successful', 'Xóa thành công');
        $model->delete();
        return redirect()->route('student');
    }
public function destroy ( Student $ student , $ slug ) { $ model = Student :: where ( 'slug' , $ slug ) -> first ( ) ; if ( $ model == null ) { return redirect ( ) -> route ( 'student' ) ; } $ response = Gate :: inspect ( 'delete' , $ model ) ; if ( ! $ response -> allowed ( ) ) { session ( ) -> flash ( 'permission' , $ response -> message ( ) ) ; return redirect ( ) -> route ( 'student' ) ; } session ( ) -> flash ( 'successful' , 'Xóa thành công'); $ model -> delete ( ) ; return redirect ( ) -> route ( 'student' ) ; }
Remove the specified resource from storage.
Remove the specified resource from storage .
/**
         * if the item has been removed
         */ /**
         * delete record on database
         */