/**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $user;
     switch (strtolower($this->option('permission'))) {
         case 'admin':
             $user = new User();
             $user->username = '******';
             $user->password = Hash::make('admin');
             $user->email = '*****@*****.**';
             $user->firstname = 'Joshua';
             $user->middlename = 'Agagdan';
             $user->lastname = 'Tundag';
             Permission::first()->users()->save($user);
             $user->save();
             break;
         case 'user':
             $user = new User();
             $user->username = '******';
             $user->password = Hash::make('gwapodz');
             $user->email = '*****@*****.**';
             $user->firstname = 'Ododz';
             $user->middlename = 'G';
             $user->lastname = 'Gwapodz';
             Permission::all()->get(1)->users()->save($user);
             $user->save();
             break;
     }
     return $user;
 }
 public function first()
 {
     return \App\Permission::first();
 }
Beispiel #3
0
 public function isAdmin()
 {
     return $this->permission == \App\Permission::first() ? true : false;
 }