R publishing, BF namespace

This commit is contained in:
a6a2f5842 2025-06-16 08:31:14 +02:00
parent 5e7510e026
commit ed457199c1
4 changed files with 15 additions and 14 deletions

View File

@ -16,7 +16,7 @@ return new class extends Migration
// Permission
Schema::create(config('roles.table_names.permissions'), function (Blueprint $table) {
$table->id();
$table->string('name')->unique();
$table->string('slug')->unique();
$table->string('description')->nullable();
$table->timestamps();
});
@ -37,8 +37,8 @@ return new class extends Migration
->nullable()
->constrained('roles')
->onDelete('set null');
$table->string('name');
$table->string('slug',32)->unique();
$table->string('name')->nullable();
$table->string('slug')->unique();
$table->string('description')->nullable();
$table->timestamps();
});

View File

@ -6,7 +6,6 @@ use Illuminate\Database\Eloquent\Model;
class Permission extends Model {
protected $fillable = [
'name',
'slug',
'description',
];

View File

@ -36,22 +36,24 @@ class PermissionsServiceProvider extends \Illuminate\Support\ServiceProvider
*/
protected function offerPublishing()
{
if (! $this->app->runningInConsole()) {
return;
}
if (! function_exists('config_path')) {
// function not available and 'publish' not relevant in Lumen
if (
! $this->app->runningInConsole()
) {
return;
}
$this->publishes([
__DIR__.'/../config/roles.php' => config_path('roles.php'),
__DIR__.'/../config/roles.php' => $this->app->configPath('roles.php'),
], 'roles-config');
$this->publishes([
__DIR__.'/../database/migrations/create_blax_role_tables.php.stub' => $this->getMigrationFileName('create_blax_role_tables.php'),
$publishesMigrationsMethod = method_exists($this, 'publishesMigrations')
? 'publishesMigrations'
: 'publishes';
$this->{$publishesMigrationsMethod}([
__DIR__.'/../database/migrations' => $this->app->databasePath('migrations'),
], 'roles-migrations');
}
/**

View File

@ -1,6 +1,6 @@
<?php
namespace Blax\Roles;
namespace Blax\Roles\Traits;
trait HasRoles
{