Пример #1
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(IndividualsRequest $request)
 {
     $individual = Individual::create($request->all());
     $individual->publish = $request->input('publish', false);
     if ($request->file('photo')) {
         $fileName = $individual->id . "." . $request->file('photo')->getClientOriginalExtension();
         $request->file('photo')->move(base_path() . '/storage/app/images/', $fileName);
         $individual->photo = '/storage/app/images/' . $fileName;
         $img = Image::make(base_path() . $individual->photo);
         $img->resize(250, 250);
         $img->save(base_path() . '/storage/app/images/' . $fileName);
     }
     $individual->save();
     $society = $individual->household->society_id;
     return redirect(url('/') . '/' . $society . '/households/' . $individual->household_id)->with('okmessage', 'New person has been added');
 }
Пример #2
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(HouseholdsRequest $request)
 {
     $society = $request->society_id;
     $household = Household::create($request->except('centrelat', 'centrelong', 'societyname'));
     $indiv = Individual::create(['household_id' => $household->id, 'surname' => $household->sortsurname, 'firstname' => 'New']);
     $channel = strtolower($household->society->society) . "-database";
     Helpers::slackmessage("New household added to database: " . $household->addressee, $channel);
     return Redirect::route('society.households.individuals.edit', array($society, $household->id, $indiv->id))->with('okmessage', 'Household has been added - now add an individual');
 }