Ejemplo n.º 1
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request $request
  * @return \Illuminate\Http\Response
  */
 public function store(AgencyRequest $request)
 {
     $agency = Agency::create($request->all());
     flash()->success('Record added.');
     //return redirect('admin/agencies/' . $agency->id);
     return redirect('admin/agencies');
 }
Ejemplo n.º 2
0
 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);
     }
 }
Ejemplo n.º 3
0
 /**
  * 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));
     }
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param \Illuminate\Http\Request $request
  *
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     // Create new entry
     $agency = Agency::create($request->all());
     /*
      * Redirect to agencies with session
      * of the newly created agency
      */
     return redirect()->route('dash.agencies')->with(['flash_entry_created' => true, 'flash_entry_id' => $agency->id, 'flash_entry_title' => $agency->name, 'flash_entry_route' => 'dash.agencies.edit']);
 }
Ejemplo n.º 5
0
 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);
 }