Example #1
0
 /**
  * Bootstrap the application services.
  *
  * @return void
  */
 public function boot()
 {
     User::saving(function ($user) {
         /* if(User::count() == 0) {
                $user->jobgroup = 'application_supervisor';
            } */
         return true;
     });
 }
Example #2
0
 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     Noticia::creating(function ($noticia) {
         $noticia->slugify();
     });
     Noticia::saving(function ($noticia) {
         if (Request::hasFile('imagen')) {
             $arch = Request::file('imagen');
             Storage::put('noticias/' . $noticia->id . '.' . $arch->getClientOriginalExtension(), File::get($arch));
             $data = File::get($arch);
         }
     });
     User::saving(function ($user) {
         if (Request::has('password')) {
             $user->password = bcrypt(Request::get('password'));
         }
     });
 }
Example #3
0
 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     //
     User::saving(function ($user) {
         if ($user->password != '' && $user->remember_token == '') {
             $user->password = bcrypt($user->password);
         }
         //return $user;
     });
     Ficha::saved(function ($ficha) {
         if (Request::hasFile('archivo')) {
             $arch = Request::file('archivo');
             Storage::put('fichas/' . $ficha->id . '.pdf', File::get($arch));
         }
         if (Request::hasFile('imagen')) {
             $arch = Request::file('imagen');
             Storage::put('fichas/' . $ficha->id . '.' . $arch->getClientOriginalExtension(), File::get($arch));
             $data = File::get($arch);
         }
     });
 }