Advertisement
Guest User

Untitled

a guest
Dec 22nd, 2014
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1.  
  2. public function store()
  3. {
  4. // move this to a "emailExists() method or something.
  5. if (Farmer::where('email', Input::get('email')->first()) {
  6. return $farmer->id;
  7. }
  8.  
  9. // bad (use validation, input::only, or make sure you guard eloquent model)
  10. $arr = Input::all();
  11.  
  12. // use a mutator on your model and get rid of this line also
  13. $arr['dob'] = \Carbon::createFromTimeStamp(strtotime($arr['dob'])));
  14.  
  15. return $this->respondCreated(Farmer::create($arr));
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement