app/Http/Controllers/Admin/StudentsController.php
/**
     * Remove the specified resource from storage.
     *
     * @param  \App\User  $user
     * @return \Illuminate\Http\Response
     */
Remove the specified resource from storage.
Remove the specified resource from storage .
public function destroy(User $student)
    {
        if (Gate::denies('manage-students')) {
            session()->flash('error', "You don't have enough permission.");
            return redirect()->route('admin.students.index');
        }
        $student->subjects()->detach();
        $student->roles()->detach();
        $student->delete();
        session()->flash('success', "You have removed student!");
        return redirect() -> route('admin.students.index');
    }
public function destroy ( User $ student ) { if ( Gate :: denies ( 'manage-students' ) ) { session ( ) -> flash ( 'error' , " You don't have enough permission. " ) ; return redirect ( ) -> route ( 'admin.students.index' ) ; } $ student -> subjects ( ) -> detach ( ) ; $ student -> roles ( ) -> detach ( ) ; $ student -> delete ( ) ; session ( ) -> flash ( 'success' , " You have removed student! " ) ; return redirect ( ) -> route ( 'admin.students.index' ) ; }
Remove the specified resource from storage.
Remove the specified resource from storage .