feat: agrega migraciones para permisos de gestión de APK
This commit is contained in:
parent
b8f210478e
commit
53f451c54c
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use App\Models\PermissionType;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Spatie\Permission\Models\Permission;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$apk = PermissionType::firstOrCreate(['name' => 'App Móvil']);
|
||||
|
||||
Permission::firstOrCreate(
|
||||
['name' => 'apk.index'],
|
||||
['guard_name' => 'api', 'description' => 'Ver lista de versiones del apk', 'permission_type_id' => $apk->id]
|
||||
);
|
||||
|
||||
$apk = PermissionType::firstOrCreate(['name' => 'Cargar Apk']);
|
||||
|
||||
Permission::firstOrCreate(
|
||||
['name' => 'apk.create'],
|
||||
['guard_name' => 'api', 'description' => 'Crear nueva versión del apk', 'permission_type_id' => $apk->id]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Permission::whereIn('name', ['apk.index', 'apk.create'])->delete();
|
||||
}
|
||||
};
|
||||
Loading…
x
Reference in New Issue
Block a user