本文整理匯總了PHP中app\Permission::first方法的典型用法代碼示例。如果您正苦於以下問題:PHP Permission::first方法的具體用法?PHP Permission::first怎麽用?PHP Permission::first使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類app\Permission
的用法示例。
在下文中一共展示了Permission::first方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: handle
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$user;
switch (strtolower($this->option('permission'))) {
case 'admin':
$user = new User();
$user->username = 'admin';
$user->password = Hash::make('admin');
$user->email = 'admin@example.com';
$user->firstname = 'Joshua';
$user->middlename = 'Agagdan';
$user->lastname = 'Tundag';
Permission::first()->users()->save($user);
$user->save();
break;
case 'user':
$user = new User();
$user->username = 'ododz';
$user->password = Hash::make('gwapodz');
$user->email = 'odozd@gwapodz.com';
$user->firstname = 'Ododz';
$user->middlename = 'G';
$user->lastname = 'Gwapodz';
Permission::all()->get(1)->users()->save($user);
$user->save();
break;
}
return $user;
}
示例2: first
public function first()
{
return \App\Permission::first();
}
示例3: isAdmin
public function isAdmin()
{
return $this->permission == \App\Permission::first() ? true : false;
}