Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function store(GeckoRequest $request)
- {
- $user_id = Auth::user()->id;
- $input = $request->all();
- $input['genetics'] = json_encode($input['genetics'], JSON_FORCE_OBJECT);
- $input['user_id'] = $user_id;
- Gecko::create($input);
- $name = str_replace(' ', '-', $request['name']);
- flash()->success('Success!', 'Your gecko has been added to the system');
- return redirect()->action('GeckoController@show', [$name]);
- }
- public function randomId(){
- $id = str_random(10);
- $validator = Validator::make(['id'=>$id],['id'=>'unique:table,col']);
- if($validator->fails()){
- return $this->randomId();
- }
- return $id;
- }
- do
- {
- $code = // generate your code
- $gecko_code = Gecko::where('code', $code)->first();
- }
- while(!empty($gecko_code));
Add Comment
Please, Sign In to add comment