app/Http/Controllers/ClassController.php
/**
     * Remove the specified resource from storage.
     *
     * @param  \App\Classes  $classes
     * @return \Illuminate\Http\Response
     */
Remove the specified resource from storage.
Remove the specified resource from storage .
public function destroy(Classes $classes, $slug)
    {
        $model = Classes::where('slug', $slug)->first();
        if ($model == null) {
            return redirect()->route('class');
        }
        try {
            $model->delete();
        } catch (\Illuminate\Database\QueryException $e) {
            session()->flash('error', 'Lớp này còn sinh viên nên không được xóa');
            return redirect()->route('class');
        }
        session()->flash('successful', 'Xóa thành công');
        return redirect()->route('class');
    }
public function destroy ( Classes $ classes , $ slug ) { $ model = Classes :: where ( 'slug' , $ slug ) -> first ( ) ; if ( $ model == null ) { return redirect ( ) -> route ( 'class' ) ; } try { $ model -> delete ( ) ; } catch ( \ Illuminate \ Database \ QueryException $ e ) { session ( ) -> flash ( 'error' , 'Lớp này còn sinh viên nên không được xóa'); return redirect ( ) -> route ( 'class' ) ; } session ( ) -> flash ( 'successful' , 'Xóa thành công'); return redirect ( ) -> route ( 'class' ) ; }
Remove the specified resource from storage.
Remove the specified resource from storage .
/**
         * if the item has been removed
         */ /**
         * delete record on database
         */