Yohohohohohooho | Sanrei Aya
Sanrei Aya


Server : LiteSpeed
System : Linux barito.iixcp.rumahweb.net 5.14.0-611.49.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Apr 21 16:39:08 EDT 2026 x86_64
User : elvh3918 ( 1528)
PHP Version : 8.2.31
Disable Function : mail
Directory :  /home/elvh3918/public_html/tenant/database/migrations/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/elvh3918/public_html/tenant/database/migrations/2025_08_07_111122_view_vw_permissions.php
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        DB::unprepared('DROP VIEW IF EXISTS vw_permissions');
        DB::unprepared(
            "CREATE VIEW vw_permissions AS
            SELECT id,
                SUBSTRING_INDEX(name,'_',1) AS project,
                SUBSTRING_INDEX(SUBSTRING_INDEX(name,'_',2),'_',-1) AS module,
                SUBSTRING_INDEX(SUBSTRING_INDEX(name,'_',3),'_',-1) AS unit,
                SUBSTRING_INDEX(SUBSTRING_INDEX(name,'_',4),'_',-1) AS program,
                SUBSTRING_INDEX(SUBSTRING_INDEX(name,'_',5),'_',-1) AS permission
            , is_active, guard_name, created_at, updated_at
            FROM 
                permissions
            ;
        ");
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        DB::unprepared('DROP VIEW IF EXISTS vw_permissions');
    }
};

Yohohohohohooho | Sanrei Aya