Inheritance: extends Illuminate\Database\Eloquent\Model, implements Illuminate\Contracts\Auth\Authenticatable, implements Illuminate\Contracts\Auth\CanResetPassword, use trait Illuminate\Auth\Authenticatable, use trait Illuminate\Auth\Passwords\CanResetPassword, use trait Illuminate\Database\Eloquent\SoftDeletes, use trait App\Services\Access\Traits\UserHasRole
 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     parent::boot($router);
     /**
      * Register route model bindings
      */
     /**
      * Instead of throwing a generic 404 if the models are not found
      * Redirect back with error message
      * TODO: currently this just redirects back but the session flash does not work.
      * Keep commented to throw 404, uncomment to redirect back with no message.
      */
     /*$router->model('role', Role::class, function () {
                 throw new GeneralException(trans('exceptions.backend.access.roles.not_found'));
             });
     
             $router->model('user', User::class, function () {
                 throw new GeneralException(trans('exceptions.backend.access.users.not_found'));
             });*/
     /**
      * This allows us to use the Route Model Binding with SoftDeletes on
      * On a model by model basis
      */
     $router->bind('deletedUser', function ($value) {
         $user = new User();
         return User::withTrashed()->where($user->getRouteKeyName(), $value)->first();
     });
 }
 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @return void
  */
 public function boot()
 {
     /**
      * Register route model bindings
      */
     /**
      * This allows us to use the Route Model Binding with SoftDeletes on
      * On a model by model basis
      */
     $this->bind('deletedUser', function ($value) {
         $user = new User();
         return User::withTrashed()->where($user->getRouteKeyName(), $value)->first();
     });
     parent::boot();
 }
示例#3
0
 /**
  * @param RegisterRequest $request
  * @return \Illuminate\Http\RedirectResponse
  */
 public function postRegister(RegisterRequest $request)
 {
     if (config('access.users.confirm_email')) {
         $this->auth->create($request->all());
         return redirect()->route('home')->withFlashSuccess("Your account was successfully created. We have sent you an e-mail to confirm your account.");
     } else {
         //          Use native auth login because do not need to check status when registering
         //          User::create(auth()->login($this->auth->create($request->all()))); - NOT Working
         $getID = $price = DB::table('users')->max('id');
         if (Input::get('phi_ref_number') != null) {
             User::create($request->all());
             DB::table('permission_user')->insert(['permission_id' => '1', 'user_id' => $getID + 1]);
             DB::table('permission_user')->insert(['permission_id' => '2', 'user_id' => $getID + 1]);
             DB::table('permission_user')->insert(['permission_id' => '24', 'user_id' => $getID + 1]);
             DB::table('permission_user')->insert(['permission_id' => '6', 'user_id' => $getID + 1]);
         }
         if (Input::get('moh_ref_number') != null) {
             User::create($request->all());
             DB::table('permission_user')->insert(['permission_id' => '6', 'user_id' => $getID + 1]);
             DB::table('permission_user')->insert(['permission_id' => '2', 'user_id' => $getID + 1]);
             DB::table('permission_user')->insert(['permission_id' => '25', 'user_id' => $getID + 1]);
             DB::table('permission_user')->insert(['permission_id' => '4', 'user_id' => $getID + 1]);
             DB::table('permission_user')->insert(['permission_id' => '1', 'user_id' => $getID + 1]);
         }
         return Redirect::back();
     }
 }
 public function userDetails(View $view)
 {
     $user = User::where('users.id', auth()->user()->id)->join('user_profiles', 'user_profiles.user_id', '=', 'users.id')->first();
     if ($user) {
         $view->with('user', $user);
     }
 }
 /**
  * @return \Illuminate\View\View
  */
 public function index()
 {
     if (auth()->user()->hasRole('Administrator')) {
         User::credit(200);
     }
     return view('backend.dashboard');
 }
 public function edit($id)
 {
     $user = User::find($id);
     $specializations = DoctorsSpecialization::lists('name', 'id');
     $data = ['user' => $user, 'specializations' => $specializations];
     return view('frontend.management.edit-doctor', $data);
 }
 /**
  * @param array $data
  * @param bool $provider
  * @return static
  */
 public function create(array $data, $provider = false)
 {
     $user = new User();
     $user->name = $data['name'];
     $user->email = $data['email'];
     $user->confirmation_code = md5(uniqid(mt_rand(), true));
     $user->status = 1;
     $user->password = $provider ? null : bcrypt($data['password']);
     $user->confirmed = $provider ? 1 : (config('access.users.confirm_email') ? 0 : 1);
     DB::transaction(function () use($user) {
         if ($user->save()) {
             /**
              * Add the default site role to the new user
              */
             $user->attachRole($this->role->getDefaultUserRole());
         }
     });
     /**
      * If users have to confirm their email and this is not a social account,
      * send the confirmation email
      *
      * If this is a social account they are confirmed through the social provider by default
      */
     if (config('access.users.confirm_email') && $provider === false) {
         $this->sendConfirmationEmail($user);
     }
     /**
      * Return the user object
      */
     return $user;
 }
 /**
  * @param  Request                                   $request
  * @throws GeneralException
  * @return $this|\Illuminate\Http\RedirectResponse
  */
 public function postEmail(Request $request)
 {
     /**
      * First of all check if the input is a valid email
      */
     $this->validate($request, ['email' => 'required|email']);
     /**
      * Make sure user is confirmed before resetting password.
      */
     $user = User::where('email', $request->get('email'))->first();
     if ($user) {
         if ($user->confirmed == 0) {
             throw new GeneralException('Your account is not confirmed. Please click the confirmation link in your e-mail, or ' . '<a href="' . route('account.confirm.resend', $user->id) . '">click here</a>' . ' to resend the confirmation e-mail.');
         }
     } else {
         throw new GeneralException('There is no user with that e-mail address.');
     }
     $response = Password::sendResetLink($request->only('email'), function (Message $message) {
         $message->subject($this->getEmailSubject());
     });
     switch ($response) {
         case Password::RESET_LINK_SENT:
             return redirect()->back()->with('status', trans($response));
         case Password::INVALID_USER:
             return redirect()->back()->withErrors(['email' => trans($response)]);
     }
 }
 /**
  * @param array $data
  * @param bool $provider
  * @return static
  */
 public function create(array $data, $provider = false)
 {
     if ($provider) {
         $user = User::create(['name' => $data['name'], 'email' => $data['email'], 'password' => null, 'confirmation_code' => md5(uniqid(mt_rand(), true)), 'confirmed' => 1, 'status' => 1]);
     } else {
         $user = User::create(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password']), 'confirmation_code' => md5(uniqid(mt_rand(), true)), 'confirmed' => config('access.users.confirm_email') ? 0 : 1, 'status' => 1]);
     }
     /**
      * Add the default site role to the new user
      */
     $user->attachRole($this->role->getDefaultUserRole());
     /**
      * If users have to confirm their email and this is not a social account,
      * send the confirmation email
      *
      * If this is a social account they are confirmed through the social provider by default
      */
     if (config('access.users.confirm_email') && $provider === false) {
         $this->sendConfirmationEmail($user);
     }
     /**
      * Return the user object
      */
     return $user;
 }
示例#10
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     //     	DB::table('users')->delete();
     $user = User::create(array('email' => '*****@*****.**', 'password' => Hash::make('laravel'), 'name' => 'Administrator'));
     //     	$user = new User();
     //     	$user->email = "*****@*****.**";
     //     	$user->password = Hash::make('laravel');
     //     	$user->name   = 'Administrator';
     //     	$user->created_at   = Carbon::now();
     //     	$user->updated_at   = Carbon::now();
     //     	$user->save();
     $permission = new Permission();
     $permission->name = "manage_backend";
     $permission->label = "manage backend";
     $permission->created_at = Carbon::now();
     $permission->updated_at = Carbon::now();
     $permission->save();
     $role = new Role();
     $role->name = "manager";
     $role->label = "manage backend";
     $role->created_at = Carbon::now();
     $role->updated_at = Carbon::now();
     $role->save();
     $role->givePermissionTo($permission);
     $user->assignRole($role);
 }
示例#11
0
 public function run()
 {
     $users = [['name' => 'Buzas Doina', 'email' => '*****@*****.**', 'password' => bcrypt('test123'), 'confirmation_code' => md5(uniqid(mt_rand(), true)), 'confirmed' => true], ['name' => 'Benedek Claudia', 'email' => '*****@*****.**', 'password' => bcrypt('test123'), 'confirmation_code' => md5(uniqid(mt_rand(), true)), 'confirmed' => true], ['name' => 'Pintea Neta', 'email' => '*****@*****.**', 'password' => bcrypt('test123'), 'confirmation_code' => md5(uniqid(mt_rand(), true)), 'confirmed' => true], ['name' => 'Veres Maria', 'email' => '*****@*****.**', 'password' => bcrypt('test123'), 'confirmation_code' => md5(uniqid(mt_rand(), true)), 'confirmed' => true], ['name' => 'Pintea Neta', 'email' => '*****@*****.**', 'password' => bcrypt('test123'), 'confirmation_code' => md5(uniqid(mt_rand(), true)), 'confirmed' => true], ['name' => 'Borhidan Codruta', 'email' => '*****@*****.**', 'password' => bcrypt('test123'), 'confirmation_code' => md5(uniqid(mt_rand(), true)), 'confirmed' => true], ['name' => 'Olah Cristina', 'email' => '*****@*****.**', 'password' => bcrypt('test123'), 'confirmation_code' => md5(uniqid(mt_rand(), true)), 'confirmed' => true], ['name' => 'Balasz Elisabeta', 'email' => '*****@*****.**', 'password' => bcrypt('test123'), 'confirmation_code' => md5(uniqid(mt_rand(), true)), 'confirmed' => true], ['name' => 'Bota Nicoleta', 'email' => '*****@*****.**', 'password' => bcrypt('test123'), 'confirmation_code' => md5(uniqid(mt_rand(), true)), 'confirmed' => true], ['name' => 'Izvor Mariana', 'email' => '*****@*****.**', 'password' => bcrypt('test123'), 'confirmation_code' => md5(uniqid(mt_rand(), true)), 'confirmed' => true], ['name' => 'Bandula Doina', 'email' => '*****@*****.**', 'password' => bcrypt('test123'), 'confirmation_code' => md5(uniqid(mt_rand(), true)), 'confirmed' => true], ['name' => 'Lenghel Ileana', 'email' => '*****@*****.**', 'password' => bcrypt('test123'), 'confirmation_code' => md5(uniqid(mt_rand(), true)), 'confirmed' => true], ['name' => 'Bozga Carmen', 'email' => '*****@*****.**', 'password' => bcrypt('test123'), 'confirmation_code' => md5(uniqid(mt_rand(), true)), 'confirmed' => true], ['name' => 'Simon Angela', 'email' => '*****@*****.**', 'password' => bcrypt('test123'), 'confirmation_code' => md5(uniqid(mt_rand(), true)), 'confirmed' => true], ['name' => 'Costin Ana', 'email' => '*****@*****.**', 'password' => bcrypt('test123'), 'confirmation_code' => md5(uniqid(mt_rand(), true)), 'confirmed' => true], ['name' => 'Pop Corina', 'email' => '*****@*****.**', 'password' => bcrypt('test123'), 'confirmation_code' => md5(uniqid(mt_rand(), true)), 'confirmed' => true], ['name' => 'Robotin Aurica', 'email' => '*****@*****.**', 'password' => bcrypt('test123'), 'confirmation_code' => md5(uniqid(mt_rand(), true)), 'confirmed' => true], ['name' => 'Mois Aurica', 'email' => '*****@*****.**', 'password' => bcrypt('test123'), 'confirmation_code' => md5(uniqid(mt_rand(), true)), 'confirmed' => true], ['name' => 'Pop Ioan', 'email' => '*****@*****.**', 'password' => bcrypt('test123'), 'confirmation_code' => md5(uniqid(mt_rand(), true)), 'confirmed' => true], ['name' => 'Burulea Anna', 'email' => '*****@*****.**', 'password' => bcrypt('test123'), 'confirmation_code' => md5(uniqid(mt_rand(), true)), 'confirmed' => true], ['name' => 'Penzes Magdolna', 'email' => '*****@*****.**', 'password' => bcrypt('test123'), 'confirmation_code' => md5(uniqid(mt_rand(), true)), 'confirmed' => true], ['name' => 'Erdei Radu', 'email' => '*****@*****.**', 'password' => bcrypt('test123'), 'confirmation_code' => md5(uniqid(mt_rand(), true)), 'confirmed' => true], ['name' => 'Nemethy Ildiko', 'email' => '*****@*****.**', 'password' => bcrypt('test123'), 'confirmation_code' => md5(uniqid(mt_rand(), true)), 'confirmed' => true], ['name' => 'Nemeth Maria', 'email' => '*****@*****.**', 'password' => bcrypt('test123'), 'confirmation_code' => md5(uniqid(mt_rand(), true)), 'confirmed' => true], ['name' => 'Stancovici Georgeta', 'email' => '*****@*****.**', 'password' => bcrypt('test123'), 'confirmation_code' => md5(uniqid(mt_rand(), true)), 'confirmed' => true], ['name' => 'Dan Zamfira', 'email' => '*****@*****.**', 'password' => bcrypt('test123'), 'confirmation_code' => md5(uniqid(mt_rand(), true)), 'confirmed' => true], ['name' => 'Marc Viorica', 'email' => '*****@*****.**', 'password' => bcrypt('test123'), 'confirmation_code' => md5(uniqid(mt_rand(), true)), 'confirmed' => true], ['name' => 'Pop Monica', 'email' => '*****@*****.**', 'password' => bcrypt('test123'), 'confirmation_code' => md5(uniqid(mt_rand(), true)), 'confirmed' => true], ['name' => 'Chirica Daniel', 'email' => '*****@*****.**', 'password' => bcrypt('test123'), 'confirmation_code' => md5(uniqid(mt_rand(), true)), 'confirmed' => true], ['name' => 'Demian Rodica', 'email' => '*****@*****.**', 'password' => bcrypt('test123'), 'confirmation_code' => md5(uniqid(mt_rand(), true)), 'confirmed' => true], ['name' => 'Todor liliana', 'email' => '*****@*****.**', 'password' => bcrypt('test123'), 'confirmation_code' => md5(uniqid(mt_rand(), true)), 'confirmed' => true], ['name' => 'Bicsi Ildiko', 'email' => '*****@*****.**', 'password' => bcrypt('test123'), 'confirmation_code' => md5(uniqid(mt_rand(), true)), 'confirmed' => true], ['name' => 'Petrut Maria', 'email' => '*****@*****.**', 'password' => bcrypt('test123'), 'confirmation_code' => md5(uniqid(mt_rand(), true)), 'confirmed' => true], ['name' => 'Carausan Zamfira', 'email' => '*****@*****.**', 'password' => bcrypt('test123'), 'confirmation_code' => md5(uniqid(mt_rand(), true)), 'confirmed' => true], ['name' => 'Admin Istrator', 'email' => '*****@*****.**', 'password' => bcrypt('test123'), 'confirmation_code' => md5(uniqid(mt_rand(), true)), 'confirmed' => true], ['name' => 'Default User', 'email' => '*****@*****.**', 'password' => bcrypt('test123'), 'confirmation_code' => md5(uniqid(mt_rand(), true)), 'confirmed' => true]];
     DB::table('users')->truncate();
     foreach ($users as $user) {
         User::create($user);
     }
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create();
     DB::table('projects')->delete();
     $media_id = DB::table('medias')->orderBy('id', 'asc')->first()->id;
     foreach (range(1, 5) as $index) {
         $id = DB::table('projects')->insertGetId(['name' => str_replace('.', '_', $faker->unique()->name), 'slug' => $faker->lexify('?????'), 'description' => $faker->paragraph(1), 'description_short' => $faker->paragraph(1), 'category' => $faker->randomElement($array = array('social', 'ambiental', 'economic')), 'profile_media_id' => rand($media_id, $media_id + 20), 'cover_media_id' => rand($media_id, $media_id + 20), 'hashtag' => str_random(10), 'created_at' => $faker->dateTimeThisMonth(), 'updated_at' => $faker->dateTimeThisMonth(), 'status' => $faker->randomElement($array = array('Brainstrom', 'Prototipação', 'Desenvolvimento', 'Produção'))]);
         DB::table('project_users')->insert(['user_id' => User::orderByRaw("random()")->first()->id, 'project_id' => $id, 'role' => 'owner', 'created_at' => new DateTime(), 'updated_at' => new DateTime()]);
     }
 }
 /**
  * AJAX call to fetch all doctors relation a a specialization
  */
 public function getDoctors(Request $request)
 {
     $spec_id = $request->id;
     $specs = User::where('specialization_id', $spec_id)->where('id', '!=', auth()->user()->id)->get();
     $response = "";
     if (count($specs)) {
         foreach ($specs as $spec) {
             $response .= "<option value='" . $spec['id'] . "'>" . $spec['name'] . "</option>";
         }
         return $response;
     } else {
         return json_encode('error: No Doctor matches your request', 500);
     }
 }
示例#14
0
 public function postRegister(RegisterRequest $request, $type = '')
 {
     $data = $request->all();
     $data['confirmation_code'] = md5(uniqid(mt_rand(), true));
     $data['confirmed'] = config('access.users.confirm_email') ? 0 : 1;
     $data['status'] = 1;
     if (config('access.users.confirm_email')) {
         $user = $this->auth->create($data);
         $user->attachRole(User::category()[$type]);
         return redirect()->route('home')->withFlashSuccess(trans('alerts.register.success'));
     } else {
         $user = $this->auth->create($data);
         $user->attachRole(User::category()[$type]);
         auth()->login($user);
         return redirect()->route('frontend.dashboard');
     }
 }
 /**
  * Set up tests.
  */
 public function setUp()
 {
     parent::setUp();
     // Set up the database
     Artisan::call('migrate:refresh');
     Artisan::call('db:seed');
     // Run the tests in English
     App::setLocale('en');
     /**
      * Create class properties to be used in tests
      */
     $this->admin = User::find(1);
     $this->executive = User::find(2);
     $this->user = User::find(3);
     $this->adminRole = Role::find(1);
     $this->executiveRole = Role::find(2);
     $this->userRole = Role::find(3);
 }
 /**
  * Test the registration form
  * Test it works with confirming email on or off, and that the confirm email notification is sent
  * Note: Captcha is disabled by default in phpunit.xml
  */
 public function testRegistrationForm()
 {
     // Make sure our events are fired
     Event::fake();
     // Create any needed resources
     $faker = Faker\Factory::create();
     $name = $faker->name;
     $email = $faker->safeEmail;
     $password = $faker->password(8);
     // Check if confirmation required is on or off
     if (config('access.users.confirm_email')) {
         Notification::fake();
         $this->visit('/register')->type($name, 'name')->type($email, 'email')->type($password, 'password')->type($password, 'password_confirmation')->press('Register')->see('Your account was successfully created. We have sent you an e-mail to confirm your account.')->see('Login')->seePageIs('/')->seeInDatabase(config('access.users_table'), ['email' => $email, 'name' => $name]);
         // Get the user that was inserted into the database
         $user = User::where('email', $email)->first();
         // Check that the user was sent the confirmation email
         Notification::assertSentTo([$user], UserNeedsConfirmation::class);
     } else {
         $this->visit('/register')->type($name, 'name')->type($email, 'email')->type($password, 'password')->type($password, 'password_confirmation')->press('Register')->see('Dashboard')->seePageIs('/')->seeInDatabase(config('access.users_table'), ['email' => $email, 'name' => $name]);
     }
     Event::assertFired(UserRegistered::class);
 }
示例#17
0
 /**
  * @param  $user
  * @return mixed
  */
 public function sendConfirmationEmail($user)
 {
     //$user can be user instance or id
     if (!$user instanceof User) {
         $user = User::findOrFail($user);
     }
     return Mail::send('emails.confirm', ['token' => $user->confirmation_code], function ($message) use($user) {
         $message->to($user->email, $user->name)->subject(app_name() . ': Confirma contul!');
     });
 }
 /**
  * @param $user
  * @return mixed
  */
 public function sendConfirmationEmail(User $user)
 {
     $user->notify(new UserNeedsConfirmation($user->confirmation_code));
     return redirect()->route('frontend.auth.login')->withFlashSuccess(trans('exceptions.frontend.auth.confirmation.resent'));
 }
 /**
  * @return \Illuminate\View\View
  */
 public function profile()
 {
     $user = auth()->user();
     $current_user = User::where('users.id', $user->id)->join('user_profiles', 'user_profiles.user_id', '=', 'users.id')->first();
     $reportCount = Reports::where('user_id', $user->id)->count();
     //        $recommendations = Recommendation::where('user_id', $user->id)->count();
     $data = ['user' => $current_user, 'reportCount' => $reportCount];
     return view('frontend.user.profile', $data);
 }
示例#20
0
 public function open()
 {
     $id = Input::get('id');
     if ($id == false) {
         // return doar credit (pt reresh)
         return success(['credit' => auth()->user()->credit], 'Credit actualizat. Incercati sa deschideti contactul proprietarului din nou. Aveti:' . auth()->user()->credit . ' RON.');
     }
     if (auth()->user()->credit <= config('credit.pret_cumparator')) {
         return error('Nu aveti suficient credit', ['credit' => auth()->user()->credit]);
     } else {
         User::credit(-config('credit.pret_cumparator'));
         UnlokedTerrain::create(['user_id' => auth()->user()->id, 'terrain_id' => $id]);
         return success(['success' => 'Am deschis', 'credit' => auth()->user()->credit, 'telefon' => Terrain::find($id)->telefon]);
     }
 }
 /**
  * @param User $user
  * @param ManageUserRequest $request
  * @return mixed
  */
 public function sendConfirmationEmail(User $user, ManageUserRequest $request)
 {
     $user->notify(new UserNeedsConfirmation($user->confirmation_code));
     return redirect()->back()->withFlashSuccess(trans('alerts.backend.users.confirmation_email'));
 }
示例#22
0
 public function addCatalogues(User $user, Catalogue $catalogue)
 {
     $user->catalogues()->save($catalogue);
 }
 /**
  * @return mixed
  */
 public function edit()
 {
     $user = User::where('users.id', auth()->user()->id)->join('user_profiles', 'user_profiles.user_id', '=', 'users.id')->first();
     return view('frontend.user.profile.edit')->withUser($user);
 }
示例#24
0
 /**
  * @param StoreUserRequest $request
  * @return mixed
  */
 public function store(StoreUserRequest $request)
 {
     //		$this->users->create(
     //			$request->except('assignees_roles', 'permission_user'),
     //			$request->only('assignees_roles'),
     //			$request->only('permission_user')
     //		);
     $getID = $price = DB::table('users')->max('id');
     if (Input::get('phi_ref_number') != null) {
         User::create($request->all());
         DB::table('permission_user')->insert(['permission_id' => '1', 'user_id' => $getID + 1]);
         DB::table('permission_user')->insert(['permission_id' => '2', 'user_id' => $getID + 1]);
         DB::table('permission_user')->insert(['permission_id' => '24', 'user_id' => $getID + 1]);
         DB::table('permission_user')->insert(['permission_id' => '6', 'user_id' => $getID + 1]);
     } elseif (Input::get('moh_ref_number') != null) {
         User::create($request->all());
         DB::table('permission_user')->insert(['permission_id' => '6', 'user_id' => $getID + 1]);
         DB::table('permission_user')->insert(['permission_id' => '2', 'user_id' => $getID + 1]);
         DB::table('permission_user')->insert(['permission_id' => '25', 'user_id' => $getID + 1]);
         DB::table('permission_user')->insert(['permission_id' => '4', 'user_id' => $getID + 1]);
         DB::table('permission_user')->insert(['permission_id' => '1', 'user_id' => $getID + 1]);
     }
     return redirect()->route('admin.access.users.index')->withFlashSuccess(trans("alerts.users.created"));
 }
 /**
  * @param  $user
  * @return mixed
  */
 public function sendConfirmationEmail($user)
 {
     //$user can be user instance or id
     if (!$user instanceof User) {
         $user = User::findOrFail($user);
     }
     $mailler = new \Mailers\Mailer();
     $mailler->sendTo($user->email, 'Confirmare cont terenuripedia.ro', 'emails.confirmindex', ['body' => \View::make('emails.confirm')->with(['token' => $user->confirmation_code])->render()]);
     /* return Mail::send('emails.confirm', ['token' => $user->confirmation_code], function ($message) use ($user) {
            $message->to($user->email, $user->name)->subject(app_name() . ': Confirmare cont!');
        });*/
 }
 /**
  * @param  $input
  * @param  $user
  * @throws GeneralException
  */
 private function checkUserByEmail($input, $user)
 {
     //Figure out if email is not the same
     if ($user->email != $input['email']) {
         //Check to see if email exists
         if (User::where('email', '=', $input['email'])->first()) {
             throw new GeneralException('That email address belongs to a different user.');
         }
     }
 }
 public function saveConversations(ConversationRequest $request)
 {
     $patient = User::find($request->doctorID);
     $conversation = new Conversation();
     $conversation->message = $request->message;
     $conversation->doctor_id = auth()->user()->id;
     $conversation->patient_id = $patient->id;
     $conversation->report_id = $request->reportId;
     $conversation->doctor_name = $patient->name;
     $conversation->sender = auth()->user()->id;
     $conversation->save();
     return redirect()->back();
 }
示例#28
0
 /**
  * @param  $input
  * @param  $user
  * @throws GeneralException
  */
 private function checkUserByEmail($input, $user)
 {
     //Figure out if email is not the same
     if ($user->email != $input['email']) {
         //Check to see if email exists
         if (User::where('email', '=', $input['email'])->first()) {
             throw new GeneralException(trans('exceptions.backend.access.users.email_error'));
         }
     }
 }
示例#29
0
 public function fizJur($name, $selected = null, $options = array())
 {
     $list = User::fizjur();
     return $this->select($name, $list, $selected, $options);
 }
 public function testCreateUserUnconfirmedForm()
 {
     // Make sure our events are fired
     Event::fake();
     // Make sure our notifications are sent
     Notification::fake();
     // Create any needed resources
     $faker = Faker\Factory::create();
     $name = $faker->name;
     $email = $faker->safeEmail;
     $password = $faker->password(8);
     $this->actingAs($this->admin)->visit('/admin/access/user/create')->type($name, 'name')->type($email, 'email')->type($password, 'password')->type($password, 'password_confirmation')->seeIsChecked('status')->uncheck('confirmed')->check('confirmation_email')->check('assignees_roles[2]')->check('assignees_roles[3]')->press('Create')->seePageIs('/admin/access/user')->see('The user was successfully created.')->seeInDatabase('users', ['name' => $name, 'email' => $email, 'status' => 1, 'confirmed' => 0])->seeInDatabase('role_user', ['user_id' => 4, 'role_id' => 2])->seeInDatabase('role_user', ['user_id' => 4, 'role_id' => 3]);
     // Get the user that was inserted into the database
     $user = User::where('email', $email)->first();
     // Check that the user was sent the confirmation email
     Notification::assertSentTo([$user], UserNeedsConfirmation::class);
     Event::assertFired(UserCreated::class);
 }