public function store(Request $request) { $cargo = new Cargo(); $cargo->user_id = $request->input('user_id'); $cargo->cargo = $request->input('cargo'); $cargo->inicio = $request->input('inicio'); $cargo->fin = $request->input('fin'); $cargo->save(); $cargo->urgs()->attach($request->input('cargo_urg')); return redirect()->action('UsuarioController@show', array($request->input('user_id'))); }
public static function getUsersVoBo() { $arr_users = array(); $cargos = Cargo::with('user')->get(); foreach ($cargos as $cargo) { $arr_users[] = $cargo->user; } return $arr_users; }