public function back(Request $request, $id) { $primero = Chanel::orderBy('id', 'ASC')->whereNotNull('programming')->limit(1)->get(); if ($id == $primero[0]['id']) { $prueba = Chanel::find($id); $chanel = Chanel::all(); $noBack = 'no'; return view('Site.chanel', compact('chanel', 'prueba', 'noBack')); } else { $prueba = Chanel::where('id', '<', $id)->orderBy('id', 'DESC')->limit(1)->get(); $prueba = $prueba[0]; $chanel = Chanel::all(); return view('Site.chanel', compact('chanel', 'prueba')); } }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $canal = Chanel::find($id); $delete = $canal->delete(); if ($delete) { $message = ' ' . $canal->name . ' Deleted succesfully'; } else { $message = ' ' . $canal->name . ' It could not be deleted'; } \Session::flash('message', $message); return redirect()->route('admin.chanel.index'); }