You've already forked Epicnabbo-Catalogus-Updated-Daily
🆙 More fixes 🆙
This commit is contained in:
@@ -35,16 +35,14 @@ if (! function_exists('isDarkColor')) {
|
||||
if (! function_exists('hasPermission')) {
|
||||
function hasPermission(string $permission): bool
|
||||
{
|
||||
$value = app(PermissionsService::class)->getOrDefault($permission);
|
||||
return $value === true || $value === 1 || $value === '1';
|
||||
return app(PermissionsService::class)->getOrDefault($permission);
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('hasHousekeepingPermission')) {
|
||||
function hasHousekeepingPermission(string $permission): bool
|
||||
{
|
||||
$value = app(HousekeepingPermissionsService::class)->getOrDefault($permission);
|
||||
return $value === true || $value === 1 || $value === '1';
|
||||
return app(HousekeepingPermissionsService::class)->getOrDefault($permission);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,9 +57,11 @@ if (! function_exists('findMigration')) {
|
||||
function findMigration(string $tableName): string
|
||||
{
|
||||
static $cache = [];
|
||||
$cache = is_array($cache) ? $cache : [];
|
||||
|
||||
if (isset($cache[$tableName])) {
|
||||
return $cache[$tableName];
|
||||
$cached = $cache[$tableName];
|
||||
return is_string($cached) ? $cached : '';
|
||||
}
|
||||
|
||||
$migrationsPath = database_path('migrations');
|
||||
@@ -75,8 +75,9 @@ if (! function_exists('findMigration')) {
|
||||
if ($file->isFile() && $file->getExtension() === 'php') {
|
||||
$content = @file_get_contents($file->getPathname());
|
||||
if ($content !== false && str_contains($content, "Schema::create('$tableName'")) {
|
||||
$cache[$tableName] = $file->getFilename();
|
||||
return $file->getFilename();
|
||||
$filename = (string) $file->getFilename();
|
||||
$cache[$tableName] = $filename;
|
||||
return $filename;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -110,8 +111,8 @@ if (! function_exists('dropForeignKeyIfExists')) {
|
||||
->pluck('CONSTRAINT_NAME');
|
||||
|
||||
foreach ($foreignKeys as $foreignKey) {
|
||||
if (! empty($foreignKey)) {
|
||||
$connection->statement("ALTER TABLE {$table} DROP FOREIGN KEY {$foreignKey}");
|
||||
if (is_string($foreignKey) && $foreignKey !== '') {
|
||||
$connection->statement('ALTER TABLE ' . $table . ' DROP FOREIGN KEY ' . $foreignKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user