コード例 #1
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $pat = Partner::dontDelete($id);
     if ($pat == []) {
         $partner = Partner::findOrFail($id);
         $partner->delete();
         Session::flash('message', $partner->name . ' was deleted !');
         return redirect()->route('partners.index');
     } else {
         dd($pat);
         Session::flash('message', ' dont is possible delete  the partner is linked to any product !');
         return redirect()->route('partners.index');
     }
 }