public function edit($user_id)
 {
     $user = new User();
     $userprofile = $user::find($user_id);
     //$userprofile->avatar=empty($userprofile->avatar) ? $user->get_gravatar($userprofile->email,'180','identicon','g',false) : $userprofile->avatar;
     $userprofile->avatar = $user->get_gravatar($userprofile->email, '180', 'identicon', 'g', false);
     $userprofile->save();
     return view('users.ucenter_edit')->with('userprofile', $userprofile);
 }
 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle(UserMailer $userMailer)
 {
     $user = new User();
     $user->first_name = $this->input['first_name'];
     $user->email = $this->input['email'];
     $user->password = $this->input['password'];
     $user->confirmation_token = str_random(30);
     $user->save();
     $userMailer->setupConfirmationEmail($user)->send();
     // add to mailing list
     // $this->mailingList->add($user);
     // think about firing an event
     // event(new UserRegistered($user));
 }
 public function __construct()
 {
     view()->share('menu', Node::getMenu());
     view()->share('currentUser', Auth::user());
     //print_r(Auth::user());
     if (Auth::user()) {
         view()->share('currentUserProfile', User::find(Auth::user()->user_id));
     }
 }
 public function postRegister()
 {
     $user = new User();
     $username = trim(Request::input('username'));
     $email = trim(Request::input('email'));
     $password = trim(Request::input('password'));
     $confirm_password = trim(Request::input('confirm_password'));
     $validator = Validator::make(Request::all(), $user->validator_rule);
     if ($validator->fails()) {
         return redirect('register')->withErrors($validator);
     } else {
         //$user->email = $email;
         if ($password !== $confirm_password) {
             return redirect('register')->withErrors("密码不一致");
         }
         $user->storeUser($username, $email, $password);
         return redirect('/');
     }
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('users')->truncate();
     $member = User::create(['first_name' => 'James', 'last_name' => null, 'email' => '*****@*****.**', 'password' => env('TEST_PASSWORD'), 'confirmed' => true, 'remember_token' => str_random(10)]);
     $member->assignRole(Role::whereName('member')->first());
     $manager = User::create(['first_name' => 'James', 'last_name' => null, 'email' => '*****@*****.**', 'password' => env('TEST_PASSWORD'), 'confirmed' => true, 'remember_token' => str_random(10)]);
     $manager->assignRole(Role::whereName('member')->first());
     $manager->assignRole(Role::whereName('manager')->first());
     $admin = User::create(['first_name' => 'James', 'last_name' => null, 'email' => '*****@*****.**', 'password' => env('ADMIN_PASSWORD'), 'confirmed' => true, 'remember_token' => str_random(10)]);
     $admin->assignRole(Role::whereName('member')->first());
     $admin->assignRole(Role::whereName('manager')->first());
     $admin->assignRole(Role::whereName('admin')->first());
 }
 /**
  * Confirms a new members account via email token.
  * @param  string $confirmationToken
  * @return redirect
  */
 public function getConfirmRegistration($confirmationToken)
 {
     if (!User::where('confirmation_token', $confirmationToken)->first()) {
         flash()->warning('flash.auth.already-registered');
         return redirect()->route('login');
     }
     $user = User::where('confirmation_token', $confirmationToken)->first();
     // Can we not do this in if statement???
     $user->confirmed = true;
     $user->confirmation_token = null;
     $user->update();
     Auth::login($user);
     flash()->success('Welcome to HATCH!');
     return redirect()->route('home');
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('tags')->truncate();
     DB::table('taggables')->truncate();
     factory(App\Associations\Tag::class, 10)->create();
     foreach (Article::all() as $article) {
         $article->tags()->sync([rand(1, 10), rand(1, 10), rand(1, 10)]);
     }
     DB::table('images')->truncate();
     DB::table('imagables')->truncate();
     factory(App\Associations\Image::class, 10)->create();
     foreach (Article::all() as $article) {
         $article->images()->sync([rand(1, 10), rand(1, 10), rand(1, 10)]);
     }
     DB::table('favourites')->truncate();
     foreach (User::all() as $user) {
         $article = Article::find(rand(1, 10));
         $article2 = Article::find(rand(1, 10));
         Favourite::create(['user_id' => $user->id, 'favourable_id' => $article->id, 'favourable_type' => get_class($article)]);
         Favourite::create(['user_id' => $user->id, 'favourable_id' => $article2->id, 'favourable_type' => get_class($article2)]);
         // @todo: favourite a Product or two here
     }
 }
 public function find($id)
 {
     return User::find($id);
 }
 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array  $data
  * @return User
  */
 protected function create(array $data)
 {
     return User::create(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]);
 }
Exemple #10
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     if (app()->environment(['local']) && !User::where('username', 'test')->exists()) {
         factory(User::class)->create(['username' => 'test', 'password' => bcrypt('test')])->roles()->saveMany(Role::all());
     }
 }
Exemple #11
0
    Route::get('example/cart/insert/{product}/{quantity}', 'ExampleController@cartInsertProduct');
    Route::get('example/cart/update/{product}/{quantity}', 'ExampleController@cartUpdateProduct');
    Route::get('example/cart/delete/{product}', 'ExampleController@cartDeleteProduct');
    Route::get('example/checkout', 'ExampleController@checkoutIndex');
    Route::get('example/checkout/complete', 'ExampleController@checkoutComplete');
    /** ----------------------------------------
     *  Routes for registration and auth
     *  ----------------------------------------
     */
    Route::get('login-register', ['as' => 'login-register', 'uses' => 'Auth\\AuthController@getLoginRegisterPage']);
    Route::post('register', ['as' => 'post.register', 'uses' => 'Auth\\RegistrationController@postRegister']);
    Route::get('confirm-registration/{confirmationToken}', ['as' => 'confirm-registration', 'uses' => 'Auth\\RegistrationController@getConfirmRegistration']);
    Route::post('login', ['as' => 'post.login', 'uses' => 'Auth\\AuthController@postLogin']);
    Route::get('logout', ['as' => 'logout', 'uses' => 'Auth\\AuthController@getLogout']);
    /*
     * Social authentication routes
     */
    Route::get('social-login', ['as' => 'social-login', 'uses' => 'Auth\\SocialController@redirectToProvider']);
    Route::get('social/callback', 'Auth\\SocialController@handleProviderCallback');
    Route::get('social/callback/facebook', 'Auth\\SocialController@handleFacebookCallback');
    Route::get('social/callback/twitter', 'Auth\\SocialController@handleTwitterCallback');
    Route::get('example/async', function () {
        return \App\Accounts\User::all();
    });
    /*
     * Management routes
     */
    Route::get('manage-shop', ['as' => 'manager|manage-shop', 'uses' => 'ManagementController@getDashboard']);
    Route::resource('article', 'ArticlesController');
    Route::post('article-upload-image', ['as' => 'post.article-upload-images', 'uses' => 'ArticlesController@postUploadImages']);
});