new modules

This commit is contained in:
Mark Gregory
2026-07-24 09:25:27 +01:00
parent d7d2a3f610
commit 73f7a918c1
88 changed files with 2342 additions and 1 deletions
+6
View File
@@ -0,0 +1,6 @@
<?php
return [
'name' => 'Seo',
'enabled' => true,
];
@@ -0,0 +1,3 @@
<?php
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema;
return new class extends Migration { public function up(): void { Schema::create('seo_metadata', function(Blueprint $table): void { $table->id(); $table->morphs('seoable'); $table->string('title')->nullable(); $table->text('description')->nullable(); $table->string('canonical_url')->nullable(); $table->string('robots')->default('index,follow'); $table->string('og_title')->nullable(); $table->text('og_description')->nullable(); $table->string('og_image')->nullable(); $table->string('twitter_card')->default('summary_large_image'); $table->string('schema_type')->nullable(); $table->json('schema_data')->nullable(); $table->boolean('include_in_sitemap')->default(true); $table->decimal('sitemap_priority',2,1)->default(0.5); $table->string('sitemap_change_frequency')->default('monthly'); $table->timestamps(); $table->unique(['seoable_type','seoable_id']); }); } public function down(): void { Schema::dropIfExists('seo_metadata'); } };
+3
View File
@@ -0,0 +1,3 @@
<?php
namespace Modules\Seo\Models; use Illuminate\Database\Eloquent\Model;
final class SeoMetadata extends Model { protected $table='seo_metadata'; protected $guarded=[]; protected function casts(): array { return ['schema_data'=>'array','include_in_sitemap'=>'boolean','sitemap_priority'=>'decimal:1']; } }
@@ -0,0 +1,17 @@
<?php
namespace Modules\Seo\Providers;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Route;
final class RouteServiceProvider extends ServiceProvider
{
public function boot(): void
{
parent::boot();
$this->routes(function (): void {
Route::middleware('web')->group(module_path('Seo', 'Routes/web.php'));
});
}
}
@@ -0,0 +1,21 @@
<?php
namespace Modules\Seo\Providers;
use Illuminate\Support\ServiceProvider;
use Modules\Seo\Support\ModuleInfo;
final class SeoServiceProvider extends ServiceProvider
{
public function register(): void
{
$this->app->register(RouteServiceProvider::class);
$this->mergeConfigFrom(module_path(ModuleInfo::name(), 'Config/config.php'), ModuleInfo::nameLower());
}
public function boot(): void
{
$this->loadMigrationsFrom(module_path(ModuleInfo::name(), 'Database/Migrations'));
$this->loadViewsFrom(module_path(ModuleInfo::name(), 'Resources/views'), ModuleInfo::nameLower());
}
}
+5
View File
@@ -0,0 +1,5 @@
<?php
use Illuminate\Support\Facades\Route;
// Module routes are intentionally registered by each feature as it is enabled.
+9
View File
@@ -0,0 +1,9 @@
<?php
namespace Modules\Seo\Support;
final class ModuleInfo
{
public static function name(): string { return 'Seo'; }
public static function nameLower(): string { return 'seo'; }
}
@@ -0,0 +1,5 @@
<?php
it('boots the Seo module', function (): void {
expect(config('seo.name'))->toBe('Seo');
});
+10
View File
@@ -0,0 +1,10 @@
{
"name": "absdev/seo-module",
"description": "Seo foundation module for the ABSDEV Laravel application platform.",
"type": "laravel-module",
"autoload": {
"psr-4": {
"Modules\\Seo\\": ""
}
}
}
+20
View File
@@ -0,0 +1,20 @@
{
"name": "Seo",
"alias": "seo",
"version": "1.0.0",
"description": "Seo foundation module for the ABSDEV Laravel application platform.",
"keywords": [
"laravel",
"modules",
"seo"
],
"priority": 10,
"providers": [
"Modules\\Seo\\Providers\\SeoServiceProvider"
],
"aliases": {},
"files": [],
"requires": [
"Core"
]
}