app/Http/Controllers/RecipeController.php
/**
     * Remove the specified resource from storage.
     *
     * @param  int  $id
     * @return Response
     */
Remove the specified resource from storage.
@param  int  $id
@return Response
Remove the specified resource from storage . @param int $id @return Response
public function destroy($id)
    {
        $recipe = Recipe::find($id);
        if (Auth::User()->id == $recipe->user_id) {
            Recipe::find($id)->delete();           
            WantToMakeList::where('recipe_id', '=', $id)->delete();
            RecipeInCookBook::where('recipe_id', '=', $id)->delete();
            Comment::where('recipe_id', '=', $id)->delete();
            return redirect()->action('RecipeController@index');
        }
        else return redirect()->action('RecipeController@show', $id);
    }
public function destroy ( $ id ) { $ recipe = Recipe :: find ( $ id ) ; if ( Auth :: User ( ) -> id == $ recipe -> user_id ) { Recipe :: find ( $ id ) -> delete ( ) ; WantToMakeList :: where ( 'recipe_id' , '=' , $ id ) -> delete ( ) ; RecipeInCookBook :: where ( 'recipe_id' , '=' , $ id ) -> delete ( ) ; Comment :: where ( 'recipe_id' , '=' , $ id ) -> delete ( ) ; return redirect ( ) -> action ( 'RecipeController@index' ) ; } else return redirect ( ) -> action ( 'RecipeController@show' , $ id ) ; }
Remove the specified resource from storage.
Remove the specified resource from storage .