Beispiel #1
0
 /**
  * @param array $attributes
  */
 public function loadRelated(array $attributes)
 {
     parent::loadRelated($attributes);
     if (isset($attributes['from'])) {
         $this->from = User::create($attributes['from']);
     }
     if (isset($attributes['chat'])) {
         $this->chat = isset($attributes['chat']->title) ? GroupChat::create($attributes['chat']) : User::create($attributes['chat']);
     }
     if (isset($attributes['forward_from'])) {
         $this->forward_from = User::create($attributes['forward_from']);
     }
     if (isset($attributes['forward_from_chat'])) {
         $this->forward_from_chat = Chat::create($attributes['forward_from_chat']);
     }
     if (isset($attributes['reply_to_message'])) {
         $this->reply_to_message = Message::create($attributes['reply_to_message']);
     }
     if (isset($attributes['entities'])) {
         $this->entities = array_map(function ($entity) {
             return MessageEntity::create($entity);
         }, $attributes['entities']);
     }
     if (isset($attributes['audio'])) {
         $this->audio = Audio::create($attributes['audio']);
     }
     if (isset($attributes['document'])) {
         $this->document = Document::create($attributes['document']);
     }
     if (isset($attributes['photo'])) {
         $this->photo = array_map(function ($photo) {
             return PhotoSize::create($photo);
         }, $attributes['photo']);
     }
     if (isset($attributes['sticker'])) {
         $this->sticker = Sticker::create($attributes['sticker']);
     }
     if (isset($attributes['video'])) {
         $this->video = Video::create($attributes['video']);
     }
     if (isset($attributes['voice'])) {
         $this->voice = Voice::create($attributes['voice']);
     }
     if (isset($attributes['contact'])) {
         $this->contact = Contact::create($attributes['contact']);
     }
     if (isset($attributes['location'])) {
         $this->location = Location::create($attributes['location']);
     }
     if (isset($attributes['venue'])) {
         $this->venue = Venue::create($attributes['venue']);
     }
     if (isset($attributes['new_chat_member'])) {
         $this->new_chat_member = User::create($attributes['new_chat_member']);
     }
     if (isset($attributes['left_chat_member'])) {
         $this->left_chat_member = new User($attributes['left_chat_member']);
     }
     if (isset($attributes['new_chat_photo'])) {
         $this->new_chat_photo = array_map(function ($photo) {
             return PhotoSize::create($photo);
         }, $attributes['new_chat_photo']);
     }
 }
 public function complete_store()
 {
     $rules = array('password' => 'required|min:6|confirmed', 'password_confirmation' => 'required|min:6');
     $validator = Validator::make($data = Input::all(), $rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $final_data = Session::get('data');
     $data = array_merge($final_data, $data);
     $user_name = explode(' ', $data['full_name']);
     $data['fname'] = isset($user_name[0]) ? $user_name[0] : '';
     $data['lname'] = isset($user_name[1]) ? $user_name[1] : '';
     $plain_password = $data['password'];
     $data['password'] = Hash::make($data['password']);
     $user = User::create($data);
     $user->role = 2;
     $venu = Venue::create($data);
     $profile = Profile::create($data);
     $data['name'] = $data['business_name'];
     unset($data['business_name']);
     $business = Business::create($data);
     $business->user_id = $user->id;
     $profile->user_id = $user->id;
     $venu->business_id = $business->id;
     $user->save();
     $business->save();
     $profile->save();
     $venu->save();
     $where = array("email" => $user->email, 'password' => $plain_password);
     if (Auth::attempt($where)) {
         return Redirect::to('/business/dashboard/')->with('message', 'Successfully Login!');
     }
     return Redirect::to('/')->with('message', 'Signed up succesflly');
 }