first
This commit is contained in:
90
app/Filament/Pages/HomePageSettings.php
Normal file
90
app/Filament/Pages/HomePageSettings.php
Normal file
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Pages;
|
||||
|
||||
use App\Settings\HomeSettings;
|
||||
use Filament\Forms\Components\Grid;
|
||||
use Filament\Forms\Components\Section;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Pages\Page;
|
||||
use Filament\Pages\SettingsPage;
|
||||
use Illuminate\Contracts\Support\Htmlable;
|
||||
|
||||
class HomePageSettings extends SettingsPage
|
||||
{
|
||||
protected static ?string $navigationIcon = 'heroicon-o-home';
|
||||
|
||||
protected static string $settings = HomeSettings::class;
|
||||
|
||||
protected static string $view = 'filament.pages.home-page-settings';
|
||||
|
||||
public function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Section::make('Hero Section')
|
||||
->description('Manage the main hero section content on the homepage.')
|
||||
->icon('heroicon-o-photo')
|
||||
->schema([
|
||||
TextInput::make('hero_badge_text')
|
||||
->label('Hero Badge Text')
|
||||
->maxLength(50),
|
||||
TextInput::make('hero_header')
|
||||
->label('Hero Header')
|
||||
->required()
|
||||
->maxLength(100),
|
||||
Textarea::make('hero_sub_header')
|
||||
->label('Hero Sub Header')
|
||||
->rows(3)
|
||||
->maxLength(255),
|
||||
Grid::make()->schema([
|
||||
TextInput::make('hero_link_button_text')
|
||||
->label('Hero Button Text')
|
||||
->maxLength(50),
|
||||
TextInput::make('hero_link_button_url')
|
||||
->label('Hero Button URL')
|
||||
->maxLength(255)
|
||||
->url(),
|
||||
])->columns(2),
|
||||
]),
|
||||
Section::make('Background Video')
|
||||
->description('Upload or link the background video for the hero section.')
|
||||
->icon('heroicon-o-video')
|
||||
->schema([
|
||||
TextInput::make('bg_video')
|
||||
->label('Background Video URL')
|
||||
->maxLength(255)
|
||||
->url(),
|
||||
]),
|
||||
])
|
||||
->columns(1)
|
||||
->statePath('data');
|
||||
}
|
||||
|
||||
public static function getNavigationGroup(): ?string
|
||||
{
|
||||
return __('CMS');
|
||||
}
|
||||
|
||||
public static function getNavigationLabel(): string
|
||||
{
|
||||
return __('Home');
|
||||
}
|
||||
|
||||
public function getTitle(): string|Htmlable
|
||||
{
|
||||
return 'Home';
|
||||
}
|
||||
|
||||
public function getHeading(): string|Htmlable
|
||||
{
|
||||
return 'Edit homepage text and images from here';
|
||||
}
|
||||
|
||||
public function getSubheading(): string|Htmlable|null
|
||||
{
|
||||
return 'Manage the homepage hero section, background video, and call-to-action content.';
|
||||
}
|
||||
}
|
||||
159
app/Filament/Pages/ManageSite.php
Normal file
159
app/Filament/Pages/ManageSite.php
Normal file
@@ -0,0 +1,159 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Pages;
|
||||
|
||||
use App\Settings\SiteSettings;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Pages\SettingsPage;
|
||||
use Illuminate\Contracts\Support\Htmlable;
|
||||
|
||||
class ManageSite extends SettingsPage
|
||||
{
|
||||
protected static ?string $navigationIcon = 'heroicon-o-globe-alt';
|
||||
|
||||
protected static string $settings = SiteSettings::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
$this->getSaveFormAction()
|
||||
->formId('form'),
|
||||
];
|
||||
}
|
||||
|
||||
public function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\Section::make('Basic Information')
|
||||
->description('General website configuration')
|
||||
->icon('heroicon-o-information-circle')
|
||||
->collapsible()
|
||||
->schema([
|
||||
Forms\Components\Grid::make()->schema([
|
||||
Forms\Components\TextInput::make('name')
|
||||
->label('Site Name')
|
||||
->required()
|
||||
->maxLength(100),
|
||||
Forms\Components\TextInput::make('tagline')
|
||||
->label('Site Tagline')
|
||||
->helperText('A short phrase describing your site')
|
||||
->maxLength(150),
|
||||
Forms\Components\Textarea::make('description')
|
||||
->label('Site Description')
|
||||
->helperText('A detailed description of your website')
|
||||
->rows(3)
|
||||
->maxLength(500),
|
||||
])->columns(2),
|
||||
]),
|
||||
|
||||
Forms\Components\Section::make('Company Information')
|
||||
->description('Contact details and location information')
|
||||
->icon('heroicon-o-building-office')
|
||||
->collapsible()
|
||||
->schema([
|
||||
Forms\Components\Grid::make()->schema([
|
||||
Forms\Components\TextInput::make('company_name')
|
||||
->label('Company Name')
|
||||
->required()
|
||||
->maxLength(100),
|
||||
Forms\Components\TextInput::make('company_email')
|
||||
->label('Company Email')
|
||||
->email()
|
||||
->required()
|
||||
->maxLength(100),
|
||||
Forms\Components\TextInput::make('company_phone')
|
||||
->label('Company Phone')
|
||||
->maxLength(20),
|
||||
Forms\Components\TextInput::make('company_phone_2')
|
||||
->label('Company Additional Phone')
|
||||
->maxLength(20),
|
||||
])->columns(2),
|
||||
Forms\Components\Textarea::make('company_address')
|
||||
->label('Company Address')
|
||||
->rows(2)
|
||||
->maxLength(200),
|
||||
]),
|
||||
|
||||
Forms\Components\Section::make('Legal Information')
|
||||
->description('Copyright and legal page URLs')
|
||||
->icon('heroicon-o-document-text')
|
||||
->collapsible()
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('footer_company_header')
|
||||
->label('Footer header')
|
||||
->required()
|
||||
->maxLength(100),
|
||||
]),
|
||||
|
||||
Forms\Components\Section::make('Legal Information')
|
||||
->description('Copyright and legal page URLs')
|
||||
->icon('heroicon-o-document-text')
|
||||
->collapsible()
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('copyright_text')
|
||||
->label('Copyright Text')
|
||||
->maxLength(200),
|
||||
|
||||
Forms\Components\Grid::make()->schema([
|
||||
Forms\Components\TextInput::make('terms_url')
|
||||
->label('Terms & Conditions URL')
|
||||
->maxLength(100)
|
||||
->prefix(function (Forms\Get $get) {
|
||||
return url('/');
|
||||
}),
|
||||
Forms\Components\TextInput::make('privacy_url')
|
||||
->label('Privacy Policy URL')
|
||||
->maxLength(100)
|
||||
->prefix(function (Forms\Get $get) {
|
||||
return url('/');
|
||||
}),
|
||||
])->columns(2),
|
||||
]),
|
||||
|
||||
Forms\Components\Section::make('Error Messages')
|
||||
->description('Custom error messages for your website')
|
||||
->icon('heroicon-o-exclamation-triangle')
|
||||
->collapsible()
|
||||
->schema([
|
||||
Forms\Components\Grid::make()->schema([
|
||||
Forms\Components\Textarea::make('custom_404_message')
|
||||
->label('404 Not Found Message')
|
||||
->rows(2)
|
||||
->maxLength(500),
|
||||
Forms\Components\Textarea::make('custom_500_message')
|
||||
->label('500 Server Error Message')
|
||||
->rows(2)
|
||||
->maxLength(500),
|
||||
])->columns(2),
|
||||
]),
|
||||
])
|
||||
->columns(3);
|
||||
}
|
||||
|
||||
public static function getNavigationGroup(): ?string
|
||||
{
|
||||
return __('Settings');
|
||||
}
|
||||
|
||||
public static function getNavigationLabel(): string
|
||||
{
|
||||
return 'Website';
|
||||
}
|
||||
|
||||
public function getTitle(): string|Htmlable
|
||||
{
|
||||
return 'Website Settings';
|
||||
}
|
||||
|
||||
public function getHeading(): string|Htmlable
|
||||
{
|
||||
return 'Website Settings';
|
||||
}
|
||||
|
||||
public function getSubheading(): string|Htmlable|null
|
||||
{
|
||||
return 'Manage your website\'s general configuration';
|
||||
}
|
||||
}
|
||||
76
app/Filament/Pages/ManageSiteSocialSettings.php
Normal file
76
app/Filament/Pages/ManageSiteSocialSettings.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Pages;
|
||||
|
||||
use App\Settings\SiteSocialSettings;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Pages\SettingsPage;
|
||||
use Illuminate\Contracts\Support\Htmlable;
|
||||
|
||||
class ManageSiteSocialSettings extends SettingsPage
|
||||
{
|
||||
protected static ?int $navigationSort = 4;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-share';
|
||||
|
||||
protected static string $settings = SiteSocialSettings::class;
|
||||
|
||||
public function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\Section::make('Social Media Profiles')
|
||||
->description('Links to your social media profiles')
|
||||
->icon('heroicon-o-link')
|
||||
->collapsible()
|
||||
->schema([
|
||||
Forms\Components\Grid::make()->schema([
|
||||
Forms\Components\TextInput::make('facebook_url')
|
||||
->label('Facebook URL')
|
||||
->prefix('https://')
|
||||
->helperText('e.g., facebook.com/yourpage'),
|
||||
Forms\Components\TextInput::make('twitter_url')
|
||||
->label('Twitter/X URL')
|
||||
->prefix('https://')
|
||||
->helperText('e.g., twitter.com/yourusername'),
|
||||
Forms\Components\TextInput::make('instagram_url')
|
||||
->label('Instagram URL')
|
||||
->prefix('https://')
|
||||
->helperText('e.g., instagram.com/yourusername'),
|
||||
Forms\Components\TextInput::make('linkedin_url')
|
||||
->label('LinkedIn URL')
|
||||
->prefix('https://')
|
||||
->helperText('e.g., linkedin.com/company/yourcompany'),
|
||||
])->columns(2),
|
||||
]),
|
||||
])
|
||||
->columns(3)
|
||||
->statePath('data');
|
||||
}
|
||||
|
||||
public static function getNavigationGroup(): ?string
|
||||
{
|
||||
return __('Settings');
|
||||
}
|
||||
|
||||
public static function getNavigationLabel(): string
|
||||
{
|
||||
return 'Social Media';
|
||||
}
|
||||
|
||||
public function getTitle(): string|Htmlable
|
||||
{
|
||||
return 'Site Social Media Settings';
|
||||
}
|
||||
|
||||
public function getHeading(): string|Htmlable
|
||||
{
|
||||
return 'Site Social Media Settings';
|
||||
}
|
||||
|
||||
public function getSubheading(): string|Htmlable|null
|
||||
{
|
||||
return 'Manage your social media profiles and sharing options';
|
||||
}
|
||||
}
|
||||
84
app/Filament/Resources/BrandResource.php
Normal file
84
app/Filament/Resources/BrandResource.php
Normal file
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Resources\BrandResource\Pages;
|
||||
use App\Filament\Resources\BrandResource\RelationManagers;
|
||||
use App\Models\Brand;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Columns\ImageColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Columns\ToggleColumn;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
|
||||
class BrandResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Brand::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
TextInput::make('name')
|
||||
->rules(['required', 'string', 'max:255'])
|
||||
->unique(ignoreRecord: true),
|
||||
|
||||
FileUpload::make('image')
|
||||
->image()
|
||||
->imageEditor()
|
||||
->rules(['required', 'image',]),
|
||||
|
||||
Toggle::make('active')
|
||||
->label('Is active')
|
||||
->onColor('success')
|
||||
->offColor('danger')
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('name')
|
||||
->sortable()
|
||||
->searchable(),
|
||||
|
||||
ImageColumn::make('image')
|
||||
->extraImgAttributes(['loading' => 'lazy']),
|
||||
|
||||
ToggleColumn::make('active')
|
||||
->label('Is active')
|
||||
->onColor('success')
|
||||
->offColor('danger'),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
Tables\Actions\DeleteAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ManageBrands::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
19
app/Filament/Resources/BrandResource/Pages/ManageBrands.php
Normal file
19
app/Filament/Resources/BrandResource/Pages/ManageBrands.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\BrandResource\Pages;
|
||||
|
||||
use App\Filament\Resources\BrandResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ManageRecords;
|
||||
|
||||
class ManageBrands extends ManageRecords
|
||||
{
|
||||
protected static string $resource = BrandResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
18
app/Helpers/helpers.php
Normal file
18
app/Helpers/helpers.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/**
|
||||
* Log
|
||||
*/
|
||||
function logDB(): void
|
||||
{
|
||||
if (! app()->isLocal()) {
|
||||
return;
|
||||
}
|
||||
|
||||
DB::listen(function ($query) {
|
||||
Log::info($query->sql, $query->bindings, $query->time);
|
||||
});
|
||||
}
|
||||
11
app/Http/Controllers/AboutusPageController.php
Normal file
11
app/Http/Controllers/AboutusPageController.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
class AboutusPageController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
return view('web.pages.about.index');
|
||||
}
|
||||
}
|
||||
10
app/Http/Controllers/BrandController.php
Normal file
10
app/Http/Controllers/BrandController.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class BrandController extends Controller
|
||||
{
|
||||
//
|
||||
}
|
||||
8
app/Http/Controllers/CareersPageController.php
Normal file
8
app/Http/Controllers/CareersPageController.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
class CareersPageController extends Controller
|
||||
{
|
||||
//
|
||||
}
|
||||
8
app/Http/Controllers/ContactPageController.php
Normal file
8
app/Http/Controllers/ContactPageController.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
class ContactPageController extends Controller
|
||||
{
|
||||
//
|
||||
}
|
||||
8
app/Http/Controllers/Controller.php
Normal file
8
app/Http/Controllers/Controller.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
abstract class Controller
|
||||
{
|
||||
//
|
||||
}
|
||||
11
app/Http/Controllers/HomePageController.php
Normal file
11
app/Http/Controllers/HomePageController.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
class HomePageController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
return view('web.pages.home.index');
|
||||
}
|
||||
}
|
||||
8
app/Http/Controllers/InternshipsPageController.php
Normal file
8
app/Http/Controllers/InternshipsPageController.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
class InternshipsPageController extends Controller
|
||||
{
|
||||
//
|
||||
}
|
||||
8
app/Http/Controllers/LegalPageController.php
Normal file
8
app/Http/Controllers/LegalPageController.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
class LegalPageController extends Controller
|
||||
{
|
||||
//
|
||||
}
|
||||
8
app/Http/Controllers/NewsPageController.php
Normal file
8
app/Http/Controllers/NewsPageController.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
class NewsPageController extends Controller
|
||||
{
|
||||
//
|
||||
}
|
||||
8
app/Http/Controllers/OurSolutionPageController.php
Normal file
8
app/Http/Controllers/OurSolutionPageController.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
class OurSolutionPageController extends Controller
|
||||
{
|
||||
//
|
||||
}
|
||||
8
app/Http/Controllers/StoryPageController.php
Normal file
8
app/Http/Controllers/StoryPageController.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
class StoryPageController extends Controller
|
||||
{
|
||||
//
|
||||
}
|
||||
45
app/Models/Brand.php
Normal file
45
app/Models/Brand.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property string $name
|
||||
* @property string $image
|
||||
* @property boolean $active
|
||||
* @property \Illuminate\Support\Facades\Date $created_at
|
||||
* @property \Illuminate\Support\Facades\Date $updated_at
|
||||
*/
|
||||
class Brand extends Model
|
||||
{
|
||||
/**
|
||||
* Casts
|
||||
* @var array<string, string>
|
||||
*/
|
||||
protected $casts = [
|
||||
'active' => 'boolean',
|
||||
];
|
||||
|
||||
/**
|
||||
* Booted
|
||||
*/
|
||||
protected static function booted(): void
|
||||
{
|
||||
static::deleted(function ($model) {
|
||||
if ($model->image) {
|
||||
Storage::disk('public')->delete($model->image);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Image url
|
||||
*/
|
||||
public function imageUrl(): string
|
||||
{
|
||||
return url('/storage/' . $this->image);
|
||||
}
|
||||
}
|
||||
48
app/Models/User.php
Normal file
48
app/Models/User.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
/** @use HasFactory<\Database\Factories\UserFactory> */
|
||||
use HasFactory, Notifiable;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'email',
|
||||
'password',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be hidden for serialization.
|
||||
*
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $hidden = [
|
||||
'password',
|
||||
'remember_token',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the attributes that should be cast.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'email_verified_at' => 'datetime',
|
||||
'password' => 'hashed',
|
||||
];
|
||||
}
|
||||
}
|
||||
53
app/Providers/AppServiceProvider.php
Normal file
53
app/Providers/AppServiceProvider.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Filament\CMS\Home\HomeSettings;
|
||||
use App\Models\Brand;
|
||||
use App\Settings\SiteSettings;
|
||||
use App\Settings\SiteSocialSettings;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\View as ViewFacade;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register any application services.
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
Model::unguard();
|
||||
|
||||
$this->addSettingsToViews();
|
||||
|
||||
// logDB();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add settings to views
|
||||
*/
|
||||
public function addSettingsToViews(): void
|
||||
{
|
||||
ViewFacade::composer(['web.layouts.app'], function (View $view) {
|
||||
$view->with('settings', app(SiteSettings::class));
|
||||
$view->with('socialMedia', app(SiteSocialSettings::class));
|
||||
});
|
||||
|
||||
ViewFacade::composer('web.pages.home.index', function (View $view) {
|
||||
$brands = Brand::query()->get(['id', 'image']);
|
||||
|
||||
$view->with('homepage', app(HomeSettings::class));
|
||||
$view->with('brands', $brands);
|
||||
});
|
||||
}
|
||||
}
|
||||
61
app/Providers/Filament/PanelPanelProvider.php
Normal file
61
app/Providers/Filament/PanelPanelProvider.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers\Filament;
|
||||
|
||||
use Filament\Http\Middleware\Authenticate;
|
||||
use Filament\Http\Middleware\AuthenticateSession;
|
||||
use Filament\Http\Middleware\DisableBladeIconComponents;
|
||||
use Filament\Http\Middleware\DispatchServingFilamentEvent;
|
||||
use Filament\Pages;
|
||||
use Filament\Panel;
|
||||
use Filament\PanelProvider;
|
||||
use Filament\Support\Colors\Color;
|
||||
use Filament\Widgets;
|
||||
use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse;
|
||||
use Illuminate\Cookie\Middleware\EncryptCookies;
|
||||
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken;
|
||||
use Illuminate\Routing\Middleware\SubstituteBindings;
|
||||
use Illuminate\Session\Middleware\StartSession;
|
||||
use Illuminate\View\Middleware\ShareErrorsFromSession;
|
||||
|
||||
class PanelPanelProvider extends PanelProvider
|
||||
{
|
||||
public function panel(Panel $panel): Panel
|
||||
{
|
||||
return $panel
|
||||
->default()
|
||||
->id('panel')
|
||||
->path('panel')
|
||||
->login()
|
||||
->colors([
|
||||
'primary' => Color::Amber,
|
||||
])
|
||||
->discoverResources(in: app_path('Filament/Resources'), for: 'App\\Filament\\Resources')
|
||||
->discoverPages(in: app_path('Filament/Pages'), for: 'App\\Filament\\Pages')
|
||||
->pages([
|
||||
Pages\Dashboard::class,
|
||||
])
|
||||
->discoverWidgets(in: app_path('Filament/Widgets'), for: 'App\\Filament\\Widgets')
|
||||
->widgets([
|
||||
Widgets\AccountWidget::class,
|
||||
Widgets\FilamentInfoWidget::class,
|
||||
])
|
||||
->middleware([
|
||||
EncryptCookies::class,
|
||||
AddQueuedCookiesToResponse::class,
|
||||
StartSession::class,
|
||||
AuthenticateSession::class,
|
||||
ShareErrorsFromSession::class,
|
||||
VerifyCsrfToken::class,
|
||||
SubstituteBindings::class,
|
||||
DisableBladeIconComponents::class,
|
||||
DispatchServingFilamentEvent::class,
|
||||
])
|
||||
->authMiddleware([
|
||||
Authenticate::class,
|
||||
])
|
||||
->resources([
|
||||
config('filament-logger.activity_resource'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
25
app/Settings/GeneralSettings.php
Normal file
25
app/Settings/GeneralSettings.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Settings;
|
||||
|
||||
use Spatie\LaravelSettings\Settings;
|
||||
|
||||
class GeneralSettings extends Settings
|
||||
{
|
||||
public string $brand_name;
|
||||
|
||||
public ?string $brand_logo;
|
||||
|
||||
public string $brand_logoHeight;
|
||||
|
||||
public ?string $site_favicon;
|
||||
|
||||
public array $site_theme;
|
||||
|
||||
public bool $search_engine_indexing;
|
||||
|
||||
public static function group(): string
|
||||
{
|
||||
return 'general';
|
||||
}
|
||||
}
|
||||
25
app/Settings/HomeSettings.php
Normal file
25
app/Settings/HomeSettings.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Settings;
|
||||
|
||||
use Spatie\LaravelSettings\Settings;
|
||||
|
||||
class HomeSettings extends Settings
|
||||
{
|
||||
public string $bg_video;
|
||||
|
||||
public string $hero_badge_text;
|
||||
|
||||
public string $hero_header;
|
||||
|
||||
public string $hero_sub_header;
|
||||
|
||||
public string $hero_link_button_url;
|
||||
|
||||
public string $hero_link_button_text;
|
||||
|
||||
public static function group(): string
|
||||
{
|
||||
return 'cms_homepage';
|
||||
}
|
||||
}
|
||||
202
app/Settings/MailSettings.php
Normal file
202
app/Settings/MailSettings.php
Normal file
@@ -0,0 +1,202 @@
|
||||
<?php
|
||||
|
||||
namespace App\Settings;
|
||||
|
||||
use Spatie\LaravelSettings\Settings;
|
||||
|
||||
class MailSettings extends Settings
|
||||
{
|
||||
public string $from_address;
|
||||
|
||||
public string $from_name;
|
||||
|
||||
public string $reply_to_address;
|
||||
|
||||
public string $reply_to_name;
|
||||
|
||||
// SMTP configuration
|
||||
public ?string $driver;
|
||||
|
||||
public ?string $host;
|
||||
|
||||
public int $port;
|
||||
|
||||
public string $encryption;
|
||||
|
||||
public ?string $username;
|
||||
|
||||
public ?string $password;
|
||||
|
||||
public ?int $timeout;
|
||||
|
||||
public ?string $local_domain;
|
||||
|
||||
// Email template and design settings
|
||||
public string $template_theme;
|
||||
|
||||
public string $footer_text;
|
||||
|
||||
public string $logo_path;
|
||||
|
||||
public string $primary_color;
|
||||
|
||||
public string $secondary_color;
|
||||
|
||||
// Email delivery configuration
|
||||
public bool $queue_emails;
|
||||
|
||||
public string $queue_name;
|
||||
|
||||
public string $queue_connection;
|
||||
|
||||
public array $rate_limiting;
|
||||
|
||||
// Notification settings
|
||||
public bool $notifications_enabled;
|
||||
|
||||
public array $notification_types;
|
||||
|
||||
// Email testing and debugging
|
||||
public bool $test_mode;
|
||||
|
||||
public string $log_channel;
|
||||
|
||||
public string $test_to_address;
|
||||
|
||||
// Alternative mail providers configuration
|
||||
public array $providers;
|
||||
|
||||
public static function group(): string
|
||||
{
|
||||
return 'mail';
|
||||
}
|
||||
|
||||
public static function encrypted(): array
|
||||
{
|
||||
return [
|
||||
'username',
|
||||
'password',
|
||||
'providers.mailgun.secret',
|
||||
'providers.postmark.token',
|
||||
'providers.ses.key',
|
||||
'providers.ses.secret',
|
||||
];
|
||||
}
|
||||
|
||||
public function loadMailSettingsToConfig($data = null): void
|
||||
{
|
||||
// Core mail configuration
|
||||
config([
|
||||
'mail.default' => $data['driver'] ?? $this->driver,
|
||||
'mail.mailers.smtp.host' => $data['host'] ?? $this->host,
|
||||
'mail.mailers.smtp.port' => $data['port'] ?? $this->port,
|
||||
'mail.mailers.smtp.encryption' => $data['encryption'] ?? $this->encryption,
|
||||
'mail.mailers.smtp.username' => $data['username'] ?? $this->username,
|
||||
'mail.mailers.smtp.password' => $data['password'] ?? $this->password,
|
||||
'mail.mailers.smtp.timeout' => $data['timeout'] ?? $this->timeout,
|
||||
'mail.mailers.smtp.local_domain' => $data['local_domain'] ?? $this->local_domain,
|
||||
'mail.from.address' => $data['from_address'] ?? $this->from_address,
|
||||
'mail.from.name' => $data['from_name'] ?? $this->from_name,
|
||||
]);
|
||||
|
||||
// Reply-to configuration
|
||||
if (isset($data['reply_to_address']) || $this->reply_to_address) {
|
||||
config([
|
||||
'mail.reply_to.address' => $data['reply_to_address'] ?? $this->reply_to_address,
|
||||
'mail.reply_to.name' => $data['reply_to_name'] ?? $this->reply_to_name,
|
||||
]);
|
||||
}
|
||||
|
||||
// Queue configuration
|
||||
if ($this->queue_emails) {
|
||||
config([
|
||||
'queue.connections.'.$this->queue_connection.'.queue' => $this->queue_name,
|
||||
'mail.queue.connection' => $this->queue_connection,
|
||||
'mail.queue.queue' => $this->queue_name,
|
||||
]);
|
||||
}
|
||||
|
||||
// Configure alternative mail providers if driver matches
|
||||
if ($this->driver === 'mailgun' && isset($this->providers['mailgun'])) {
|
||||
config([
|
||||
'services.mailgun.domain' => $this->providers['mailgun']['domain'],
|
||||
'services.mailgun.secret' => $this->providers['mailgun']['secret'],
|
||||
'services.mailgun.endpoint' => $this->providers['mailgun']['endpoint'],
|
||||
]);
|
||||
} elseif ($this->driver === 'postmark' && isset($this->providers['postmark'])) {
|
||||
config([
|
||||
'services.postmark.token' => $this->providers['postmark']['token'],
|
||||
]);
|
||||
} elseif ($this->driver === 'ses' && isset($this->providers['ses'])) {
|
||||
config([
|
||||
'services.ses.key' => $this->providers['ses']['key'],
|
||||
'services.ses.secret' => $this->providers['ses']['secret'],
|
||||
'services.ses.region' => $this->providers['ses']['region'],
|
||||
]);
|
||||
}
|
||||
|
||||
// Test mode configuration
|
||||
if ($this->test_mode) {
|
||||
config([
|
||||
'mail.to.address' => $this->test_to_address,
|
||||
'mail.to.name' => 'Test Recipient',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if MailSettings is configured with necessary values.
|
||||
*/
|
||||
public function isMailSettingsConfigured(): bool
|
||||
{
|
||||
// Basic configuration check
|
||||
$hasBasicConfig = $this->from_address && $this->from_name;
|
||||
|
||||
// Driver-specific validation
|
||||
if ($this->driver === 'smtp') {
|
||||
return $hasBasicConfig && $this->host && $this->username && $this->password;
|
||||
} elseif ($this->driver === 'mailgun') {
|
||||
return $hasBasicConfig && isset($this->providers['mailgun']['domain']) && isset($this->providers['mailgun']['secret']);
|
||||
} elseif ($this->driver === 'postmark') {
|
||||
return $hasBasicConfig && isset($this->providers['postmark']['token']);
|
||||
} elseif ($this->driver === 'ses') {
|
||||
return $hasBasicConfig && isset($this->providers['ses']['key']) && isset($this->providers['ses']['secret']);
|
||||
}
|
||||
|
||||
return $hasBasicConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get email theme configuration for templates
|
||||
*/
|
||||
public function getEmailThemeConfig(): array
|
||||
{
|
||||
return [
|
||||
'logo' => $this->logo_path,
|
||||
'colors' => [
|
||||
'primary' => $this->primary_color,
|
||||
'secondary' => $this->secondary_color,
|
||||
],
|
||||
'footer' => $this->footer_text,
|
||||
'theme' => $this->template_theme,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a specific notification type is enabled
|
||||
*/
|
||||
public function isNotificationTypeEnabled(string $type): bool
|
||||
{
|
||||
return $this->notifications_enabled &&
|
||||
isset($this->notification_types[$type]) &&
|
||||
$this->notification_types[$type];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get rate limiting configuration
|
||||
*/
|
||||
public function getRateLimitingConfig(): array
|
||||
{
|
||||
return $this->rate_limiting;
|
||||
}
|
||||
}
|
||||
33
app/Settings/SiteScriptSettings.php
Normal file
33
app/Settings/SiteScriptSettings.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Settings;
|
||||
|
||||
use Spatie\LaravelSettings\Settings;
|
||||
|
||||
class SiteScriptSettings extends Settings
|
||||
{
|
||||
public ?string $header_scripts;
|
||||
|
||||
public ?string $body_start_scripts;
|
||||
|
||||
public ?string $body_end_scripts;
|
||||
|
||||
public ?string $footer_scripts;
|
||||
|
||||
public bool $cookie_consent_enabled;
|
||||
|
||||
public ?string $cookie_consent_text;
|
||||
|
||||
public ?string $cookie_consent_button_text;
|
||||
|
||||
public ?string $cookie_consent_policy_url;
|
||||
|
||||
public ?string $custom_css;
|
||||
|
||||
public ?string $custom_js;
|
||||
|
||||
public static function group(): string
|
||||
{
|
||||
return 'sites_scripts';
|
||||
}
|
||||
}
|
||||
89
app/Settings/SiteSeoSettings.php
Normal file
89
app/Settings/SiteSeoSettings.php
Normal file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
namespace App\Settings;
|
||||
|
||||
use Spatie\LaravelSettings\Settings;
|
||||
|
||||
class SiteSeoSettings extends Settings
|
||||
{
|
||||
// General SEO settings
|
||||
public string $meta_title_format;
|
||||
|
||||
public string $meta_description;
|
||||
|
||||
public string $meta_keywords;
|
||||
|
||||
public ?string $canonical_url;
|
||||
|
||||
public bool $robots_indexing;
|
||||
|
||||
public bool $robots_following;
|
||||
|
||||
// Page type specific title formats
|
||||
public ?string $title_separator;
|
||||
|
||||
public ?string $blog_title_format;
|
||||
|
||||
public ?string $product_title_format;
|
||||
|
||||
public ?string $category_title_format;
|
||||
|
||||
public ?string $search_title_format;
|
||||
|
||||
public ?string $author_title_format;
|
||||
|
||||
// Open Graph settings
|
||||
public ?string $og_type;
|
||||
|
||||
public ?string $og_title;
|
||||
|
||||
public ?string $og_description;
|
||||
|
||||
public ?string $og_image;
|
||||
|
||||
public ?string $og_site_name;
|
||||
|
||||
// Twitter Card settings
|
||||
public ?string $twitter_card_type;
|
||||
|
||||
public ?string $twitter_site;
|
||||
|
||||
public ?string $twitter_creator;
|
||||
|
||||
public ?string $twitter_title;
|
||||
|
||||
public ?string $twitter_description;
|
||||
|
||||
public ?string $twitter_image;
|
||||
|
||||
// Schema.org settings
|
||||
public ?string $schema_type;
|
||||
|
||||
public ?string $schema_name;
|
||||
|
||||
public ?string $schema_description;
|
||||
|
||||
public ?string $schema_logo;
|
||||
|
||||
// Additional settings
|
||||
public ?string $head_additional_meta;
|
||||
|
||||
public ?array $verification_codes;
|
||||
|
||||
public ?string $robots_txt_content;
|
||||
|
||||
public bool $sitemap_enabled;
|
||||
|
||||
public bool $sitemap_include_pages;
|
||||
|
||||
public bool $sitemap_include_posts;
|
||||
|
||||
public bool $sitemap_include_categories;
|
||||
|
||||
public bool $sitemap_include_tags;
|
||||
|
||||
public static function group(): string
|
||||
{
|
||||
return 'sites_seo';
|
||||
}
|
||||
}
|
||||
51
app/Settings/SiteSettings.php
Normal file
51
app/Settings/SiteSettings.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Settings;
|
||||
|
||||
use Spatie\LaravelSettings\Settings;
|
||||
|
||||
class SiteSettings extends Settings
|
||||
{
|
||||
public bool $is_maintenance;
|
||||
|
||||
public string $name;
|
||||
|
||||
public string $tagline;
|
||||
|
||||
public string $description;
|
||||
|
||||
public ?string $logo;
|
||||
|
||||
public string $company_name;
|
||||
|
||||
public string $company_email;
|
||||
|
||||
public string $company_phone;
|
||||
|
||||
public ?string $company_phone_2;
|
||||
|
||||
public ?string $footer_company_header;
|
||||
|
||||
public string $company_address;
|
||||
|
||||
public string $default_language;
|
||||
|
||||
public string $timezone;
|
||||
|
||||
public string $copyright_text;
|
||||
|
||||
public string $terms_url;
|
||||
|
||||
public string $privacy_url;
|
||||
|
||||
public string $cookie_policy_url;
|
||||
|
||||
public string $custom_404_message;
|
||||
|
||||
public string $custom_500_message;
|
||||
|
||||
public static function group(): string
|
||||
{
|
||||
return 'sites';
|
||||
}
|
||||
}
|
||||
33
app/Settings/SiteSocialSettings.php
Normal file
33
app/Settings/SiteSocialSettings.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Settings;
|
||||
|
||||
use Spatie\LaravelSettings\Settings;
|
||||
|
||||
class SiteSocialSettings extends Settings
|
||||
{
|
||||
public ?string $facebook_url;
|
||||
|
||||
public ?string $twitter_url;
|
||||
|
||||
public ?string $instagram_url;
|
||||
|
||||
public ?string $linkedin_url;
|
||||
|
||||
public ?string $youtube_url;
|
||||
|
||||
public ?string $pinterest_url;
|
||||
|
||||
public ?string $tiktok_url;
|
||||
|
||||
public bool $social_share_enabled;
|
||||
|
||||
public array $social_share_platforms;
|
||||
|
||||
public ?string $social_share_default_image;
|
||||
|
||||
public static function group(): string
|
||||
{
|
||||
return 'sites_social';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user