public function run() { DB::table('offices')->truncate(); $offices = [['name' => 'Carmel', 'address' => '270 E. Carmel Dr.', 'city' => 'Carmel', 'state' => 'IN', 'zip_code' => '46032'], ['name' => 'Greenwood', 'address' => '', 'city' => '', 'state' => '', 'zip_code' => ''], ['name' => 'Downtown', 'address' => '270 E. Carmel Dr.', 'city' => 'Carmel', 'state' => 'IN', 'zip_code' => '46032'], ['name' => '96th Street', 'address' => '270 E. Carmel Dr.', 'city' => 'Carmel', 'state' => 'IN', 'zip_code' => '46032'], ['name' => 'Zionsville', 'address' => '270 E. Carmel Dr.', 'city' => 'Carmel', 'state' => 'IN', 'zip_code' => '46032'], ['name' => 'Hendricks County', 'address' => '270 E. Carmel Dr.', 'city' => 'Carmel', 'state' => 'IN', 'zip_code' => '46032']]; foreach ($offices as $office) { \App\Office::create($office); } }
/** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function create() { $offices = Office::all(); return view('document.create'); }
public function postOffices() { return Office::lists('name', 'id'); }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function getEdit($id) { $roles = Role::all()->lists('display_name', 'id'); $offices = Office::all()->lists('name', 'id'); $user = User::with('roles.perms')->findOrFail($id); return view('admin.users.edit_user', compact('user', 'roles', 'offices')); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $office = Office::find($id); $office->delete(); Flash::error('La oficina ' . $office->name . " ha sido eliminado de forma exitosa."); return redirect()->route('office.index'); }