Skip to content

Commit

Permalink
Update TranslationLoaderManager.php (#141)
Browse files Browse the repository at this point in the history
* Update TranslationLoaderManager.php

Avoid loading translation from the DB when the table does not yet exist.

* Update TranslationLoaderManager.php
  • Loading branch information
haringsrob authored Feb 18, 2022
1 parent 8ed8c90 commit a1b82cc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/TranslationLoaderManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Spatie\TranslationLoader;

use Illuminate\Translation\FileLoader;
use Illuminate\Support\Facades\Schema;
use Spatie\TranslationLoader\TranslationLoaders\TranslationLoader;

class TranslationLoaderManager extends FileLoader
Expand All @@ -18,6 +19,10 @@ class TranslationLoaderManager extends FileLoader
*/
public function load($locale, $group, $namespace = null): array
{
if (!Schema::hasTable('language_lines')) {
return parent::load($locale, $group, $namespace);
}

$fileTranslations = parent::load($locale, $group, $namespace);

if (! is_null($namespace) && $namespace !== '*') {
Expand Down

0 comments on commit a1b82cc

Please sign in to comment.