public function run() { DB::table('agencies')->delete(); $collection = [['agency' => 'Rayville State Farm', 'address' => '1 Good Neighbor', 'city' => 'Rayville', 'state_id' => 19, 'zip' => 71269, 'phone' => '3189803201', 'email' => '*****@*****.**'], ['agency' => 'Tom Collins of Jonesboro Nationwide Insurance', 'address' => '51 Cocktails Drive', 'city' => 'Jonesboro', 'state_id' => 4, 'zip' => 38889, 'phone' => '5015259210', 'email' => '*****@*****.**']]; foreach ($collection as $record) { Agency::create($record); } }
/** * Run the database seeds. * * @return void */ public function run() { $json = File::get(storage_path() . '/jsondata/agency.json'); $data = json_decode($json); foreach ($data as $obj) { Agency::create(array('id' => $obj->id, 'name' => $obj->name)); } }
public function agencies() { $query = session('query'); if (!Agency::typeExists()) { Agency::addAllToIndex(); } $agencies = Agency::search($query); return view('search', compact('agencies')); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { $groups = ['0' => 'Select User Group'] + UserGroup::select('id', 'group_name')->orderBy('group_name')->lists('group_name', 'id')->toArray(); $user = User::with('group')->findOrFail($id); $agencies = Agency::orderBy('name')->lists('name', 'id'); $dentists = Dentist::orderBy('name')->lists('name', 'id'); $data = array('user' => $user, 'groups' => $groups, 'agencies' => $agencies, 'dentists' => $dentists, 'pageTitle' => 'ODRMS - User Management - Edit: ' . $user->name); return view('libraries.users.edit', $data); }
public function update($id) { // save updated $record = $this->records->find($id); if (!$record) { Agency::create(Input::all()); return $this->respond($record); } $record->fill(Input::all())->save(); return $this->respond($record); }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(PatientRequest $request) { DB::transaction(function ($request) use($request) { $data = $request->all(); $data['pid'] = Agency::find($data['agency_id'])->pid(); $data['created_by'] = Auth::user()->id; $data['updated_by'] = Auth::user()->id; Patient::create($data); }); flash()->success('Record added.'); return redirect('records'); }
public function destroy($id) { $agency = Agency::where('id', $id)->get(); $auditions = Agency::findOrFail($id)->auditions()->get(); Agency::where('id', $id)->delete(); //reindex za elasticsearch $agency->deleteFromIndex(); foreach ($auditions as $audition) { $audition->removeFromIndex(); } flash()->success('Agency has been successfully deleted'); return redirect('/admin'); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $agency = Agency::findOrFail($id); $agency->delete(); flash()->success('Record deleted.'); return redirect('admin/agencies'); }
public function index() { $agencies = Agency::all(); return $this->respond(fractal()->collection($agencies, new AgencyTransformer())->toArray()); }
/** * [update_pic description] * @param Request $request [description] * @return [type] [description] */ public function update_pic($id, Request $request) { $agency = Agency::findOrFail($id); $img_path = 'images/agency_pic/'; $pic = $request->file('agency_pic'); //$img = Image::canvas(300, 300, '#ccc')->save($img_path . 'default.jpg'); $img = Image::make($pic)->resize(300, 300)->save($img_path . $agency->id . '.jpg'); $agency = $agency->update(['agency_pic' => $img_path . $agency->id . '.jpg']); $userId = Auth::user()->id; return redirect('/agencies/user/' . $userId); }
/** * Remove the specified resource from storage. * * @param int $id * * @return \Illuminate\Http\Response */ public function destroy($id) { Agency::destroy($id); return back(); }
/** * Show the form for editing the specified resource. * * @param int $id * * @return \Illuminate\Http\Response */ public function edit($id) { /* * Returns the specified resource 'with' all of its * relationships */ $work = Work::with('agency', 'photos')->findOrFail($id); // Pass in agencies to view $agencies = Agency::lists('name', 'id'); return view('dashboard.works.edit', ['work' => $work, 'agencies' => $agencies]); }
public function index() { $users = User::all(); $agencies = Agency::all(); return view('admin.adminIndex', compact('users', 'agencies')); }