R publishing, BF namespace
This commit is contained in:
parent
5e7510e026
commit
ed457199c1
|
|
@ -16,7 +16,7 @@ return new class extends Migration
|
||||||
// Permission
|
// Permission
|
||||||
Schema::create(config('roles.table_names.permissions'), function (Blueprint $table) {
|
Schema::create(config('roles.table_names.permissions'), function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->string('name')->unique();
|
$table->string('slug')->unique();
|
||||||
$table->string('description')->nullable();
|
$table->string('description')->nullable();
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
|
|
@ -37,8 +37,8 @@ return new class extends Migration
|
||||||
->nullable()
|
->nullable()
|
||||||
->constrained('roles')
|
->constrained('roles')
|
||||||
->onDelete('set null');
|
->onDelete('set null');
|
||||||
$table->string('name');
|
$table->string('name')->nullable();
|
||||||
$table->string('slug',32)->unique();
|
$table->string('slug')->unique();
|
||||||
$table->string('description')->nullable();
|
$table->string('description')->nullable();
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
|
|
@ -6,7 +6,6 @@ use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
class Permission extends Model {
|
class Permission extends Model {
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'name',
|
|
||||||
'slug',
|
'slug',
|
||||||
'description',
|
'description',
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -36,22 +36,24 @@ class PermissionsServiceProvider extends \Illuminate\Support\ServiceProvider
|
||||||
*/
|
*/
|
||||||
protected function offerPublishing()
|
protected function offerPublishing()
|
||||||
{
|
{
|
||||||
if (! $this->app->runningInConsole()) {
|
if (
|
||||||
return;
|
! $this->app->runningInConsole()
|
||||||
}
|
) {
|
||||||
|
|
||||||
if (! function_exists('config_path')) {
|
|
||||||
// function not available and 'publish' not relevant in Lumen
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->publishes([
|
$this->publishes([
|
||||||
__DIR__.'/../config/roles.php' => config_path('roles.php'),
|
__DIR__.'/../config/roles.php' => $this->app->configPath('roles.php'),
|
||||||
], 'roles-config');
|
], 'roles-config');
|
||||||
|
|
||||||
$this->publishes([
|
$publishesMigrationsMethod = method_exists($this, 'publishesMigrations')
|
||||||
__DIR__.'/../database/migrations/create_blax_role_tables.php.stub' => $this->getMigrationFileName('create_blax_role_tables.php'),
|
? 'publishesMigrations'
|
||||||
|
: 'publishes';
|
||||||
|
|
||||||
|
$this->{$publishesMigrationsMethod}([
|
||||||
|
__DIR__.'/../database/migrations' => $this->app->databasePath('migrations'),
|
||||||
], 'roles-migrations');
|
], 'roles-migrations');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Blax\Roles;
|
namespace Blax\Roles\Traits;
|
||||||
|
|
||||||
trait HasRoles
|
trait HasRoles
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue