diff --git a/database/migrations/2023_01_26_015720_create_seoables_table.php b/database/migrations/2023_01_26_015720_create_seoables_table.php new file mode 100644 index 0000000..0947c0d --- /dev/null +++ b/database/migrations/2023_01_26_015720_create_seoables_table.php @@ -0,0 +1,51 @@ +id(); + + $table->foreignId('seoable_id')->nullable(); + $table->string('seoable_type')->nullable(); + + $table->string('route')->nullable()->unique(); + $table->string('url')->nullable()->unique(); + + $table->string('title')->nullable(); + $table->string('description')->nullable(); + + $table->string('breadcrumb')->nullable(); + + $table->string('header')->nullable(); + $table->text('header_text')->nullable(); + + $table->text('text')->nullable(); + + $table->json('open_graph')->nullable(); + + $table->timestamps(); + + $table->unique(['seoable_id', 'seoable_type']); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('seoables'); + } +}; diff --git a/src/LaravelSeoableProvider.php b/src/LaravelSeoableProvider.php index bc3f722..4e01370 100644 --- a/src/LaravelSeoableProvider.php +++ b/src/LaravelSeoableProvider.php @@ -21,24 +21,25 @@ public function register() public function boot() { - /* + if ($this->app->runningInConsole()) { - $this->publishes([ - __DIR__ . '/../config/config.php' => config_path('laravelsitesettings.php'), - ], 'config'); + //$this->publishes([ + // __DIR__ . '/../config/config.php' => config_path('laravelsitesettings.php'), + //], 'config'); - $this->publishes([ - __DIR__ . '/../stubs/MoonShine/Resources/SettingGroupResource.php.stub' => app_path('MoonShine/Resources/SettingGroupResource.php'), - __DIR__ . '/../stubs/MoonShine/Resources/SettingResource.php.stub' => app_path('MoonShine/Resources/SettingResource.php'), - ], 'moonshine'); + //$this->publishes([ + // __DIR__ . '/../stubs/MoonShine/Resources/SettingGroupResource.php.stub' => app_path('MoonShine/Resources/SettingGroupResource.php'), + // __DIR__ . '/../stubs/MoonShine/Resources/SettingResource.php.stub' => app_path('MoonShine/Resources/SettingResource.php'), + //], 'moonshine'); $this->loadMigrationsFrom(__DIR__ . '/../database/migrations'); - } else { - config(['settings' => app('settings')->all()]); } + /* + + Blade::directive('settings', function ($expression) { return ""; }); diff --git a/src/Models/Seoable.php b/src/Models/Seoable.php new file mode 100644 index 0000000..130ebd4 --- /dev/null +++ b/src/Models/Seoable.php @@ -0,0 +1,36 @@ +morphTo(); + } + +} diff --git a/src/Traits/Models/HasSeoable.php b/src/Traits/Models/HasSeoable.php new file mode 100644 index 0000000..f497ced --- /dev/null +++ b/src/Traits/Models/HasSeoable.php @@ -0,0 +1,17 @@ +morphOne(Seoable::class, 'seoable'); + } + +}