1 | <?php |
||
2 | |||
3 | namespace Sirgrimorum\TransArticles; |
||
4 | |||
5 | use Illuminate\Support\ServiceProvider; |
||
6 | use Illuminate\Support\Facades\Blade; |
||
7 | use Illuminate\Foundation\AliasLoader; |
||
8 | use Sirgrimorum\TransArticles\GetArticleFromDataBase; |
||
9 | use Illuminate\Support\Facades\Artisan; |
||
10 | |||
11 | class TransArticlesServiceProvider extends ServiceProvider { |
||
12 | |||
13 | /** |
||
14 | * Perform post-registration booting of services. |
||
15 | * |
||
16 | * @return void |
||
17 | */ |
||
18 | public function boot() |
||
19 | { |
||
20 | $this->publishes([ |
||
21 | __DIR__ . '/Config/transarticles.php' => config_path('sirgrimorum/transarticles.php'), |
||
22 | ], 'config'); |
||
23 | $this->loadMigrationsFrom(__DIR__ . '/Migrations'); |
||
24 | |||
25 | Blade::directive('transarticles', function($nickname) { |
||
26 | $translations = new \Sirgrimorum\TransArticles\GetArticleFromDataBase($this->app); |
||
27 | return $translations->get(str_replace(['(', ')', ' ', '"', "'"], '', $nickname)); |
||
28 | }); |
||
29 | Blade::directive('transarticles_tojs', function($expression) { |
||
30 | $auxExpression = explode(',', str_replace(['(', ')', ' ', '"', "'"], '', $expression)); |
||
31 | if (count($auxExpression) > 1) |
||
32 | { |
||
33 | $scope = $auxExpression[0]; |
||
34 | $basevar = $auxExpression[1]; |
||
35 | } |
||
36 | else |
||
37 | { |
||
38 | $scope = $auxExpression[0]; |
||
39 | $basevar = ""; |
||
40 | } |
||
41 | $translations = new \Sirgrimorum\TransArticles\GetArticleFromDataBase($this->app); |
||
42 | return $translations->getjs($scope, $basevar); |
||
43 | }); |
||
44 | |||
45 | Artisan::command('transarticles:createseed', function () { |
||
46 | $bar = $this->output->createProgressBar(2); |
||
47 | $confirm = $this->choice("Do you wisth to clean the DatabaseSeeder.php list?", ['yes', 'no'], 0); |
||
48 | $bar->advance(); |
||
49 | $nombre = date("YmdHis"); |
||
50 | if ($confirm == 'yes') { |
||
51 | $this->line("Creating seed archive of articles table and celaning DatabaseSeeder"); |
||
52 | Artisan::call("iseed articles --classnamesuffix={$nombre} --chunksize=100 --clean"); |
||
53 | } else { |
||
54 | $this->line("Creating seed archive of articles table and adding to DatabaseSeeder list"); |
||
55 | Artisan::call("iseed articles --classnamesuffix={$nombre} --chunksize=100"); |
||
56 | } |
||
57 | $this->info("Seed file created with the name Articles{$nombre}Seeder.php"); |
||
0 ignored issues
–
show
|
|||
58 | $bar->advance(); |
||
59 | $bar->finish(); |
||
60 | })->describe('Create a seeder file with the current table Articles'); |
||
61 | } |
||
62 | |||
63 | /** |
||
64 | * Register any package services. |
||
65 | * |
||
66 | * @return void |
||
67 | */ |
||
68 | public function register() |
||
69 | { |
||
70 | //AliasLoader::getInstance()->alias('TransArticles', GetArticleFromDataBase::class); |
||
71 | $loader = AliasLoader::getInstance(); |
||
72 | $loader->alias( |
||
73 | 'TransArticles', GetArticleFromDataBase::class |
||
74 | ); |
||
75 | $this->app->singleton(GetArticleFromDataBase::class, function($app) { |
||
76 | return new GetArticleFromDataBase($app); |
||
77 | }); |
||
78 | //$this->app->alias(GetArticleFromDataBase::class, 'TransArticles'); |
||
79 | $this->mergeConfigFrom( |
||
80 | __DIR__ . '/Config/transarticles.php', 'sirgrimorum.transarticles' |
||
81 | ); |
||
82 | } |
||
83 | |||
84 | } |
||
85 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.