Add contact settings integration: update contact page to utilize dynamic settings for subtitle, header, paragraph, contact details, and map embed URL, enhancing content management and user experience.
This commit is contained in:
87
app/Filament/Pages/ContactPageSettings.php
Normal file
87
app/Filament/Pages/ContactPageSettings.php
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Pages;
|
||||||
|
|
||||||
|
use App\Settings\ContactSettings;
|
||||||
|
use Filament\Forms\Components\Section;
|
||||||
|
use Filament\Forms\Components\Textarea;
|
||||||
|
use Filament\Forms\Components\TextInput;
|
||||||
|
use Filament\Forms\Form;
|
||||||
|
use Filament\Pages\SettingsPage;
|
||||||
|
use Illuminate\Contracts\Support\Htmlable;
|
||||||
|
|
||||||
|
class ContactPageSettings extends SettingsPage
|
||||||
|
{
|
||||||
|
protected static ?string $navigationGroup = 'CMS';
|
||||||
|
|
||||||
|
protected static ?string $navigationIcon = 'heroicon-o-phone';
|
||||||
|
|
||||||
|
protected static string $settings = ContactSettings::class;
|
||||||
|
|
||||||
|
public function form(Form $form): Form
|
||||||
|
{
|
||||||
|
return $form
|
||||||
|
->schema([
|
||||||
|
Section::make('Contact Section')
|
||||||
|
->description('Manage the contact page content.')
|
||||||
|
->schema([
|
||||||
|
TextInput::make('contact_subtitle')
|
||||||
|
->label('Subtitle')
|
||||||
|
->maxLength(100)
|
||||||
|
->required(),
|
||||||
|
TextInput::make('contact_header')
|
||||||
|
->label('Header')
|
||||||
|
->maxLength(100)
|
||||||
|
->required(),
|
||||||
|
Textarea::make('contact_paragraph')
|
||||||
|
->label('Paragraph')
|
||||||
|
->rows(3)
|
||||||
|
->maxLength(65535)
|
||||||
|
->required(),
|
||||||
|
TextInput::make('phone_number')
|
||||||
|
->label('Phone Number')
|
||||||
|
->tel()
|
||||||
|
->required(),
|
||||||
|
TextInput::make('email_address')
|
||||||
|
->label('Email Address')
|
||||||
|
->email()
|
||||||
|
->required(),
|
||||||
|
TextInput::make('location_address')
|
||||||
|
->label('Location Address')
|
||||||
|
->maxLength(255)
|
||||||
|
->required(),
|
||||||
|
TextInput::make('map_embed_url')
|
||||||
|
->label('Google Maps Embed URL')
|
||||||
|
->url()
|
||||||
|
->required(),
|
||||||
|
])
|
||||||
|
])
|
||||||
|
->columns(1)
|
||||||
|
->statePath('data');
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getNavigationGroup(): ?string
|
||||||
|
{
|
||||||
|
return __('CMS');
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getNavigationLabel(): string
|
||||||
|
{
|
||||||
|
return __('Contact Page Settings');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTitle(): string|Htmlable
|
||||||
|
{
|
||||||
|
return 'Contact Page';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getHeading(): string|Htmlable
|
||||||
|
{
|
||||||
|
return 'Edit contact page text and information from here';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSubheading(): string|Htmlable|null
|
||||||
|
{
|
||||||
|
return 'Manage the contact form details, contact information, and map embed.';
|
||||||
|
}
|
||||||
|
}
|
||||||
27
app/Settings/ContactSettings.php
Normal file
27
app/Settings/ContactSettings.php
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Settings;
|
||||||
|
|
||||||
|
use Spatie\LaravelSettings\Settings;
|
||||||
|
|
||||||
|
class ContactSettings extends Settings
|
||||||
|
{
|
||||||
|
public string $contact_subtitle = 'Default Contact Subtitle';
|
||||||
|
|
||||||
|
public string $contact_header = 'Default Contact Header';
|
||||||
|
|
||||||
|
public string $contact_paragraph = 'This is a default paragraph for the contact page. Please update it from the Filament panel.';
|
||||||
|
|
||||||
|
public string $phone_number = '+1234567890';
|
||||||
|
|
||||||
|
public string $email_address = 'info@example.com';
|
||||||
|
|
||||||
|
public string $location_address = '123 Main St, Anytown, USA';
|
||||||
|
|
||||||
|
public string $map_embed_url = '';
|
||||||
|
|
||||||
|
public static function group(): string
|
||||||
|
{
|
||||||
|
return 'contact';
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
use App\Settings\GeneralSettings;
|
use App\Settings\GeneralSettings;
|
||||||
use App\Settings\HomeSettings;
|
use App\Settings\HomeSettings;
|
||||||
use App\Settings\SiteSettings;
|
use App\Settings\SiteSettings;
|
||||||
|
use Spatie\LaravelData\Data;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|
||||||
@@ -14,6 +15,7 @@ return [
|
|||||||
GeneralSettings::class,
|
GeneralSettings::class,
|
||||||
SiteSettings::class,
|
SiteSettings::class,
|
||||||
HomeSettings::class,
|
HomeSettings::class,
|
||||||
|
\App\Settings\ContactSettings::class,
|
||||||
],
|
],
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Spatie\LaravelSettings\Migrations\SettingsMigration;
|
||||||
|
|
||||||
|
return new class extends SettingsMigration
|
||||||
|
{
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
$this->migrator->add('contact.contact_subtitle', 'Default Contact Subtitle');
|
||||||
|
$this->migrator->add('contact.contact_header', 'Default Contact Header');
|
||||||
|
$this->migrator->add('contact.contact_paragraph', 'This is a default paragraph for the contact page. Please update it from the Filament panel.');
|
||||||
|
$this->migrator->add('contact.phone_number', '+1234567890');
|
||||||
|
$this->migrator->add('contact.email_address', 'info@example.com');
|
||||||
|
$this->migrator->add('contact.location_address', '123 Main St, Anytown, USA');
|
||||||
|
$this->migrator->add('contact.map_embed_url', '');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -1,6 +1,9 @@
|
|||||||
@extends('web.layouts.app')
|
@extends('web.layouts.app')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
|
@php
|
||||||
|
$contactSettings = app(\App\Settings\ContactSettings::class);
|
||||||
|
@endphp
|
||||||
<!-- Breadcrumb Area Start -->
|
<!-- Breadcrumb Area Start -->
|
||||||
<div class="breadcrumb__area" style="background-image: url('/web/assets/img/page/breadcrumb.jpg');">
|
<div class="breadcrumb__area" style="background-image: url('/web/assets/img/page/breadcrumb.jpg');">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
@@ -25,9 +28,9 @@
|
|||||||
<div class="col-lg-5 lg-mb-25">
|
<div class="col-lg-5 lg-mb-25">
|
||||||
<div class="contact__area-left mr-40 xl-mr-0">
|
<div class="contact__area-left mr-40 xl-mr-0">
|
||||||
<div class="title">
|
<div class="title">
|
||||||
<span class="subtitle wow fadeInLeft" data-wow-delay=".4s">Contact Us</span>
|
<span class="subtitle wow fadeInLeft" data-wow-delay=".4s">{{ $contactSettings->contact_subtitle }}</span>
|
||||||
<h2 class="title_split_anim mb-25">Get In Touch</h2>
|
<h2 class="title_split_anim mb-25">{{ $contactSettings->contact_header }}</h2>
|
||||||
<p class="wow fadeInUp" data-wow-delay=".4s">We’re here to assist you! Please reach out with any questions, feedback, or project inquiries.</p>
|
<p class="wow fadeInUp" data-wow-delay=".4s">{{ $contactSettings->contact_paragraph }}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="contact__area-left-contact wow fadeInUp" data-wow-delay=".7s">
|
<div class="contact__area-left-contact wow fadeInUp" data-wow-delay=".7s">
|
||||||
<div class="contact__area-left-contact-item">
|
<div class="contact__area-left-contact-item">
|
||||||
@@ -36,7 +39,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="contact__area-left-contact-item-content">
|
<div class="contact__area-left-contact-item-content">
|
||||||
<span>Phone:</span>
|
<span>Phone:</span>
|
||||||
<h6><a href="tel:+123 (256) 568 58">+123 (256) 568 58</a></h6>
|
<h6><a href="tel:{{ $contactSettings->phone_number }}">{{ $contactSettings->phone_number }}</a></h6>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="contact__area-left-contact-item">
|
<div class="contact__area-left-contact-item">
|
||||||
@@ -45,7 +48,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="contact__area-left-contact-item-content">
|
<div class="contact__area-left-contact-item-content">
|
||||||
<span>Email Address:</span>
|
<span>Email Address:</span>
|
||||||
<h6><a href="mailto:needhelp@gmail.com">needhelp@gmail.com</a></h6>
|
<h6><a href="mailto:{{ $contactSettings->email_address }}">{{ $contactSettings->email_address }}</a></h6>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="contact__area-left-contact-item">
|
<div class="contact__area-left-contact-item">
|
||||||
@@ -54,7 +57,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="contact__area-left-contact-item-content">
|
<div class="contact__area-left-contact-item-content">
|
||||||
<span>Location:</span>
|
<span>Location:</span>
|
||||||
<h6><a href="https://google.com/maps" target="_blank">2464 Royal Ln. Mesa, New Jersey 45463</a></h6>
|
<h6><a href="https://google.com/maps" target="_blank">{{ $contactSettings->location_address }}</a></h6>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -104,7 +107,7 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xl-12 wow fadeInUp" data-wow-delay=".4s">
|
<div class="col-xl-12 wow fadeInUp" data-wow-delay=".4s">
|
||||||
<div class="map-area">
|
<div class="map-area">
|
||||||
<iframe loading="lazy" src="https://maps.google.com/maps?q=London%20Eye%2C%20London%2C%20United%20Kingdom&t=m&z=10&output=embed&iwloc=near" title="London Eye, London, United Kingdom" aria-label="London Eye, London, United Kingdom"></iframe>
|
<iframe src="{{ $contactSettings->map_embed_url }}" loading="lazy" referrerpolicy="no-referrer-when-downgrade" title="Ashgabat, Turkmenistan" aria-label="Ashgabat, Turkmenistan"></iframe>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user