-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added mkdir excteption and updated to laravel 5.4
- Loading branch information
Mordi Sacks
committed
Mar 8, 2017
1 parent
63f599b
commit 98752cd
Showing
3 changed files
with
26 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,33 @@ | ||
<?php | ||
namespace MordiSacks\LaravelI18n; | ||
|
||
use Exception; | ||
use Illuminate\Support\ServiceProvider; | ||
use MordiSacks\I18n\I18n; | ||
|
||
class I18nServiceProvider extends ServiceProvider | ||
{ | ||
|
||
public function boot() | ||
{ | ||
if(!file_exists(resource_path('i18n'))) | ||
{ | ||
mkdir(resource_path('i18n'), 0755); | ||
} | ||
public function boot() | ||
{ | ||
if (!file_exists(resource_path('i18n'))) { | ||
if (!@mkdir(resource_path('i18n'), 0755, $recursive = true)) { | ||
$error = error_get_last(); | ||
throw new Exception('cant create directory ' . $error['message'], 1); | ||
} | ||
} | ||
|
||
I18n::$dir = resource_path('i18n'); | ||
I18n::$dir = resource_path('i18n'); | ||
|
||
I18n::$locale = env('I18N'); | ||
I18n::$locale = config('app.locale'); | ||
|
||
\Blade::directive('lang', function ($expression) | ||
{ | ||
return "<?php echo __{$expression}; ?>"; | ||
}); | ||
} | ||
\Blade::directive('lang', function ($expression) { | ||
return "<?php echo MordiSacks\\I18n\\I18n::translate({$expression}); ?>"; | ||
}); | ||
} | ||
|
||
public function register() | ||
{ | ||
public function register() | ||
{ | ||
|
||
} | ||
} | ||
} |