|
3 | 3 | namespace KgBot\LaravelLocalization\Console\Commands;
|
4 | 4 |
|
5 | 5 | use Illuminate\Console\Command;
|
6 |
| -use KgBot\LaravelLocalization\Facades\ExportLocalizations; |
7 |
| -use League\Flysystem\Adapter\Local; |
8 | 6 | use League\Flysystem\Filesystem;
|
| 7 | +use League\Flysystem\Adapter\Local; |
| 8 | +use KgBot\LaravelLocalization\Facades\ExportLocalizations; |
9 | 9 |
|
10 | 10 | class ExportMessages extends Command
|
11 | 11 | {
|
@@ -42,26 +42,23 @@ public function handle()
|
42 | 42 | {
|
43 | 43 | $messages = ExportLocalizations::export()->toArray();
|
44 | 44 |
|
45 |
| - $filepath = config( 'laravel-localization.js.filepath', resource_path( 'assets/js' ) ); |
46 |
| - $filename = config( 'laravel-localization.js.filename', 'll_messages.js' ); |
| 45 | + $filepath = config('laravel-localization.js.filepath', resource_path('assets/js')); |
| 46 | + $filename = config('laravel-localization.js.filename', 'll_messages.js'); |
47 | 47 |
|
48 |
| - $adapter = new Local( $filepath ); |
49 |
| - $filesystem = new Filesystem( $adapter ); |
| 48 | + $adapter = new Local($filepath); |
| 49 | + $filesystem = new Filesystem($adapter); |
50 | 50 |
|
51 |
| - $contents = 'export default ' . json_encode( $messages ); |
52 |
| - |
53 |
| - if ( $filesystem->has( $filename ) ) { |
54 |
| - |
55 |
| - $filesystem->delete( $filename ); |
56 |
| - $filesystem->write( $filename, $contents ); |
| 51 | + $contents = 'export default '.json_encode($messages); |
57 | 52 |
|
| 53 | + if ($filesystem->has($filename)) { |
| 54 | + $filesystem->delete($filename); |
| 55 | + $filesystem->write($filename, $contents); |
58 | 56 | } else {
|
59 |
| - |
60 |
| - $filesystem->write( $filename, $contents ); |
| 57 | + $filesystem->write($filename, $contents); |
61 | 58 | }
|
62 | 59 |
|
63 |
| - $this->info( 'Messages exported to JavaScript file, you can find them at ' . $filepath . DIRECTORY_SEPARATOR |
64 |
| - . $filename ); |
| 60 | + $this->info('Messages exported to JavaScript file, you can find them at '.$filepath.DIRECTORY_SEPARATOR |
| 61 | + .$filename); |
65 | 62 |
|
66 | 63 | return true;
|
67 | 64 | }
|
|
0 commit comments