/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { if (Auth::user()->rol == 'admin') { return view('plataforma.panel'); } else { $clientes = Clientes::lists('name', 'id'); $tareas = Tareas::where('user_id', Auth::user()->id)->orderBy('fecha_tarea')->get(); return view('plataforma.home', compact('clientes', 'tareas')); } }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $cliente = Clientes::findOrFail($id); $cliente->delete(); Session::flash('message', 'Cliente ' . $cliente->name . ' ha sido eliminado correctamente'); return redirect('admin/cliente'); }