All checks were successful
Build, Push and Deploy / build-and-push (push) Successful in 3m3s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 16s
Build, Push and Deploy / deploy-staging (push) Successful in 32s
Build, Push and Deploy / deploy-production (push) Has been skipped
Build, Push and Deploy / cleanup (push) Successful in 1s
25 lines
734 B
PHP
25 lines
734 B
PHP
<?php
|
|
|
|
namespace Spatie\Permission\Commands;
|
|
|
|
use Illuminate\Console\Command;
|
|
use Spatie\Permission\Contracts\Permission as PermissionContract;
|
|
|
|
class CreatePermission extends Command
|
|
{
|
|
protected $signature = 'permission:create-permission
|
|
{name : The name of the permission}
|
|
{guard? : The name of the guard}';
|
|
|
|
protected $description = 'Create a permission';
|
|
|
|
public function handle()
|
|
{
|
|
$permissionClass = app(PermissionContract::class);
|
|
|
|
$permission = $permissionClass::findOrCreate($this->argument('name'), $this->argument('guard'));
|
|
|
|
$this->info("Permission `{$permission->name}` ".($permission->wasRecentlyCreated ? 'created' : 'already exists'));
|
|
}
|
|
}
|