package installer

This commit is contained in:
tanch0
2024-06-11 12:16:24 +05:45
parent c569ea1d0c
commit 97f00e8172
88 changed files with 15037 additions and 3657 deletions

View File

@ -0,0 +1,31 @@
<?php
namespace App\Helpers\Installer;
use Illuminate\Support\Facades\DB;
trait MigrationsHelper
{
/**
* Get the migrations in /database/migrations.
*
* @return array Array of migrations name, empty if no migrations are existing
*/
public function getMigrations()
{
$migrations = glob(database_path().DIRECTORY_SEPARATOR.'migrations'.DIRECTORY_SEPARATOR.'*.php');
return str_replace('.php', '', $migrations);
}
/**
* Get the migrations that have already been ran.
*
* @return \Illuminate\Support\Collection List of migrations
*/
public function getExecutedMigrations()
{
// migrations table should exist, if not, user will receive an error.
return DB::table('migrations')->get()->pluck('migration');
}
}