kurious7 /
simple-pages
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Kurious7\SimplePages; |
||
| 4 | |||
| 5 | use Illuminate\Database\Eloquent\Model; |
||
| 6 | use Illuminate\Support\Facades\Route; |
||
| 7 | use Illuminate\Support\ServiceProvider; |
||
| 8 | use Kurious7\SimplePages\Contracts\SimplePage as SimplePageContract; |
||
| 9 | use Kurious7\SimplePages\Http\Controllers\SimplePagesController; |
||
| 10 | use Kurious7\SimplePages\Models\SimplePage as SimplePageModel; |
||
| 11 | |||
| 12 | class SimplePagesServiceProvider extends ServiceProvider |
||
| 13 | { |
||
| 14 | public function boot() |
||
| 15 | { |
||
| 16 | $this->loadViewsFrom(__DIR__.'/../resources/views/', 'simple-pages'); |
||
| 17 | |||
| 18 | $this->publishes([ |
||
| 19 | __DIR__.'/../resources/views/' => resource_path('views/vendor/simple-pages'), |
||
| 20 | ], 'views'); |
||
| 21 | |||
| 22 | $this->publishes([ |
||
| 23 | __DIR__.'/../config/simple-pages.php' => base_path('config/simple-pages.php'), |
||
| 24 | ], 'config'); |
||
| 25 | |||
| 26 | if (! class_exists('CreateSimplePagesTable')) { |
||
| 27 | $this->publishes([ |
||
| 28 | __DIR__.'/../database/migrations/create_simple_pages_table.php.stub' => database_path('migrations/'.date('Y_m_d_His', time()).'_create_simple_pages_table.php'), |
||
| 29 | ], 'migrations'); |
||
| 30 | } |
||
| 31 | |||
| 32 | if (config('simple-pages.route.register')) { |
||
| 33 | Route::get(config('simple-pages.route.path'), SimplePagesController::class); |
||
| 34 | } |
||
| 35 | } |
||
| 36 | |||
| 37 | public function register() |
||
| 38 | { |
||
| 39 | $this->mergeConfigFrom(__DIR__.'/../config/simple-pages.php', 'simple-pages'); |
||
| 40 | } |
||
| 41 | |||
| 42 | public static function determineSimplePageModel(): string |
||
| 43 | { |
||
| 44 | $simplePageModel = config('simpel-pages.model') ?? SimplePageModel::class; |
||
| 45 | |||
| 46 | if (! is_a($simplePageModel, SimplePage::class, true) |
||
| 47 | || ! is_a($simplePageModel, Model::class, true) |
||
| 48 | ) { |
||
| 49 | throw InvalidConfiguration::modelIsNotValid($simplePageModel); |
||
|
0 ignored issues
–
show
|
|||
| 50 | } |
||
| 51 | |||
| 52 | return $simplePageModel; |
||
| 53 | } |
||
| 54 | |||
| 55 | public static function getSimplePageModelInstance(): SimplePageContract |
||
| 56 | { |
||
| 57 | $simplePageModelClassName = self::determineSimplePageModel(); |
||
| 58 | |||
| 59 | return new $simplePageModelClassName(); |
||
| 60 | } |
||
| 61 | } |
||
| 62 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths