Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor: Seeder, views, and migrations for consistency #28

Merged
merged 8 commits into from
Feb 8, 2025
25 changes: 25 additions & 0 deletions database/factories/PageFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace database\factories;

use Fuelviews\SabHeroWrapper\Models\Page;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Carbon;

class PageFactory extends Factory
{
protected $model = Page::class;

public function definition(): array
{
return [
'slug' => $this->faker->slug(),
'title' => $this->faker->word(),
'description' => $this->faker->text(),
'image' => $this->faker->word(),
'created_at' => Carbon::now(),
'updated_at' => Carbon::now(),
'registerMediaConversionsUsingModelInstance' => $this->faker->boolean(),
];
}
}
6 changes: 1 addition & 5 deletions database/migrations/create_pages_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,9 @@ public function up(): void
$table->string('slug', 80)->unique();
$table->string('title', 80)->unique();
$table->text('description');
$table->string('image', 80)->unique();
$table->string('feature_image', 80)->unique();

$table->timestamps();

$table->index('slug');
$table->index('title');
$table->index('image');
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;

class PagesTableSeeder extends Seeder
class PageTableSeeder extends Seeder
{
/**
* Run the database seeds.
Expand Down
50 changes: 21 additions & 29 deletions resources/views/components/layouts/app.blade.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
<!doctype html>
<html lang="{{ app()->getLocale() }}">
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{ csrf_token() }}">

@if (class_exists(RalphJSmit\Laravel\SEO\SEOManager::class))
@isset($page)
{!! seo()->for($page) !!}
@endisset
@isset($post)
{!! seo()->for($post) !!}
@endisset
@if(empty($page) && empty($post))
{!! seo() !!}
@endif
{!! seo($page ?? $seoPage ?? $seoPost ?? null) !!}
@endif

@vite(['resources/css/app.css', 'resources/js/app.js'])
Expand All @@ -35,29 +28,28 @@
@endif
</head>
<body>
@if (class_exists(\Fuelviews\Navigation\Navigation::class) && config('sabhero-wrapper.navigation_enabled'))
@component('navigation::components.navigation')
@endcomponent
@endif

{{ $slot }}
@if (class_exists(\Fuelviews\Navigation\Navigation::class) && config('sabhero-wrapper.navigation_enabled'))
@component('navigation::components.navigation')
@endcomponent
@endif

@if (class_exists(\Fuelviews\Navigation\View\Components\Footer\Footer::class) && config('sabhero-wrapper.footer_enabled'))
@component('navigation::components.footer.footer')
@endcomponent
@endif
{{ $slot }}

@if (class_exists(\Fuelviews\Forms\Forms::class) && config('sabhero-wrapper.forms_modal_enabled'))
@livewire('forms-modal')
@endif
@if (class_exists(\Fuelviews\Navigation\View\Components\Footer\Footer::class) && config('sabhero-wrapper.footer_enabled'))
@component('navigation::components.footer.footer')
@endcomponent
@endif

@if (class_exists(\Spatie\GoogleTagManager\GoogleTagManager::class) && config('sabhero-wrapper.gtm_enabled'))
@include('googletagmanager::body')
@endif
@if (class_exists(\Fuelviews\Forms\Forms::class) && config('sabhero-wrapper.forms_modal_enabled'))
@livewire('forms-modal')
@endif

@if (class_exists(\Livewire\Livewire::class) && config('sabhero-wrapper.livewire_enabled'))
@livewireScripts
@endif
@if (class_exists(\Spatie\GoogleTagManager\GoogleTagManager::class) && config('sabhero-wrapper.gtm_enabled'))
@include('googletagmanager::body')
@endif

@if (class_exists(\Livewire\Livewire::class) && config('sabhero-wrapper.livewire_enabled'))
@livewireScripts
@endif
</body>
</html>
Loading