Beispiel #1
0
 public static function boot()
 {
     parent::boot();
     static::creating(function ($user) {
         $user->sp_id = 1;
         $cookie = \Cookie::get('sponsor');
         if ($cookie) {
             $user->sp_id = $cookie['user_id'];
         }
         $user->activation_code = str_random(60);
     });
     static::created(function ($user) {
         $access_token = config('services.fbapp.app_id') . '|' . config('services.fbapp.app_secret');
         $fbID = $user->facebook_user_id;
         if (!empty($fbID)) {
             $fb = app(\SammyK\LaravelFacebookSdk\LaravelFacebookSdk::class);
             $response1 = $fb->post('/' . $fbID . '/notifications', array('template' => 'Welcome @[' . $fbID . '] to Essensa Naturale!', 'href' => '@' . $user->username, 'access_token' => $access_token));
         }
         if (empty($fbID)) {
             $fbID = $user->username;
         } else {
             $fbID = '@[' . $fbID . ']';
         }
         $sponsor = $user->sponsor();
         $fbID1 = $sponsor->facebook_user_id;
         if (!empty($fbID1)) {
             $fb = app(\SammyK\LaravelFacebookSdk\LaravelFacebookSdk::class);
             $response2 = $fb->post('/' . $fbID1 . '/notifications', array('template' => 'Congratulations!  @[' . $fbID1 . '] ,' . $fbID . ' Have Signed Up in Your Link!', 'href' => '@' . $sponsor->username, 'access_token' => $access_token));
         }
     });
 }
Beispiel #2
0
 /**
  *
  */
 public static function boot()
 {
     parent::boot();
     User::creating(function ($user) {
         $user->salt = CryptoLib::genSaltBase64();
     });
 }
Beispiel #3
0
 protected static function boot()
 {
     parent::boot();
     static::deleting(function ($user) {
         $user->comments()->delete();
     });
 }
 public static function boot()
 {
     parent::boot();
     static::creating(function ($user) {
         $user->token = str_random(30);
     });
 }
Beispiel #5
0
 /**
  * Sobreescribimos lo que sucede al momento de crear un nuevo usuario
  */
 public static function boot()
 {
     parent::boot();
     static::creating(function ($model) {
         $model->uuid = Uuid::generate(4);
     });
 }
 /**
  * The "booting" method of the model.
  *
  * @return void
  */
 protected static function boot()
 {
     parent::boot();
     static::creating(function ($model) {
         $model->username_lowercase = strtolower($model->username);
     });
 }
Beispiel #7
0
 public static function boot()
 {
     parent::boot();
     static::created(function ($user) {
         $user->settings()->save(new Settings());
     });
 }
 /**
  * The "booting" method of the model.
  *
  * @return void
  */
 protected static function boot()
 {
     parent::boot();
     static::addGlobalScope('latest', function (Builder $builder) {
         $builder->orderBy('contributors.created_at', 'desc');
     });
 }
Beispiel #9
0
 public static function boot()
 {
     parent::boot();
     // Attach event handler, on deleting of the user
     User::deleting(function ($user) {
         $user->abilities()->sync([]);
     });
 }
Beispiel #10
0
 protected static function boot()
 {
     parent::boot();
     User::creating(function ($user) {
         $user->verify_code = md5(str_random(64) . time() * 64);
         $user->types = $user->types ? $user->types : 'member';
     });
 }
Beispiel #11
0
 public static function boot()
 {
     parent::boot();
     User::deleting(function ($user) {
         foreach ($user->stations as $station) {
             $station->delete();
         }
     });
 }
Beispiel #12
0
 public static function boot()
 {
     parent::boot();
     static::saving(function (User $user) {
         $attrs = $user->getDirty();
         if (isset($attrs['password'])) {
             $user->attributes['password'] = bcrypt($user->attributes['password']);
         }
     });
 }
Beispiel #13
0
 /**
  * Boot the model.
  *
  * @return void
  */
 public static function boot()
 {
     parent::boot();
     static::creating(function ($user) {
         $user->token = str_random(30);
         // first created user is automatically an admin
         if (\App\User::count() == 0) {
             $user->admin = 1;
         }
     });
 }
Beispiel #14
0
 /**
  * Bootstrap application services for user.
  *
  * @return void
  */
 public static function boot()
 {
     parent::boot();
     // Set token for email address verification
     // if user is not registered via social provider.
     static::creating(function ($user) {
         if ($user->is_verified) {
             return;
         }
         $user->token = str_random(30);
     });
 }
Beispiel #15
0
 protected static function boot()
 {
     parent::boot();
     static::deleting(function ($item) {
         // before delete() method call this
         foreach ($item->contribuyentes as $emp) {
             $emp->delete();
         }
         foreach ($item->notificaciones as $emp) {
             $emp->delete();
         }
         // do the rest of the cleanup...
     });
 }
Beispiel #16
0
 public static function boot()
 {
     parent::boot();
     User::created(function ($user) {
         // Setup default user settings for the new user
         $usettings = UserSetting::lists('default', 'id')->toArray();
         if ($usettings) {
             foreach ($usettings as $id => $value) {
                 $user_settings[$id] = ['value' => $value];
             }
             $user->settings()->sync($user_settings);
         }
     });
 }
Beispiel #17
0
 public static function boot()
 {
     parent::boot();
     static::bootStapler();
 }
Beispiel #18
0
 public static function boot()
 {
     parent::boot();
     // Setup event bindings...
 }