Refactor form components across multiple pages: enforce required validation on various text inputs and file uploads in HomePageSettings, ManagePortfolio, ManageSite, ManageSiteSocialSettings, ManageSolutions, ManageSuccess, and update the news index view to display dynamic content.
This commit is contained in:
@@ -3,14 +3,13 @@
|
|||||||
namespace App\Filament\Pages;
|
namespace App\Filament\Pages;
|
||||||
|
|
||||||
use App\Settings\HomeSettings;
|
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\Components\FileUpload;
|
use Filament\Forms\Components\FileUpload;
|
||||||
|
use Filament\Forms\Components\Grid;
|
||||||
use Filament\Forms\Components\Repeater;
|
use Filament\Forms\Components\Repeater;
|
||||||
|
use Filament\Forms\Components\Section;
|
||||||
|
use Filament\Forms\Components\Textarea;
|
||||||
|
use Filament\Forms\Components\TextInput;
|
||||||
use Filament\Forms\Form;
|
use Filament\Forms\Form;
|
||||||
use Filament\Pages\Page;
|
|
||||||
use Filament\Pages\SettingsPage;
|
use Filament\Pages\SettingsPage;
|
||||||
use Illuminate\Contracts\Support\Htmlable;
|
use Illuminate\Contracts\Support\Htmlable;
|
||||||
|
|
||||||
|
|||||||
@@ -3,11 +3,11 @@
|
|||||||
namespace App\Filament\Pages;
|
namespace App\Filament\Pages;
|
||||||
|
|
||||||
use App\Settings\PortfolioSettings;
|
use App\Settings\PortfolioSettings;
|
||||||
|
use Filament\Forms\Components\FileUpload;
|
||||||
use Filament\Forms\Components\Grid;
|
use Filament\Forms\Components\Grid;
|
||||||
|
use Filament\Forms\Components\Repeater;
|
||||||
use Filament\Forms\Components\Section;
|
use Filament\Forms\Components\Section;
|
||||||
use Filament\Forms\Components\TextInput;
|
use Filament\Forms\Components\TextInput;
|
||||||
use Filament\Forms\Components\FileUpload;
|
|
||||||
use Filament\Forms\Components\Repeater;
|
|
||||||
use Filament\Forms\Form;
|
use Filament\Forms\Form;
|
||||||
use Filament\Pages\SettingsPage;
|
use Filament\Pages\SettingsPage;
|
||||||
use Illuminate\Contracts\Support\Htmlable;
|
use Illuminate\Contracts\Support\Htmlable;
|
||||||
@@ -33,9 +33,11 @@ class ManagePortfolio extends SettingsPage
|
|||||||
Grid::make()->schema([
|
Grid::make()->schema([
|
||||||
TextInput::make('portfolio_button_text')
|
TextInput::make('portfolio_button_text')
|
||||||
->label('Button Text')
|
->label('Button Text')
|
||||||
|
->required()
|
||||||
->maxLength(50),
|
->maxLength(50),
|
||||||
TextInput::make('portfolio_button_url')
|
TextInput::make('portfolio_button_url')
|
||||||
->label('Button URL')
|
->label('Button URL')
|
||||||
|
->required()
|
||||||
->maxLength(255)
|
->maxLength(255)
|
||||||
->url(),
|
->url(),
|
||||||
])->columns(2),
|
])->columns(2),
|
||||||
@@ -49,7 +51,8 @@ class ManagePortfolio extends SettingsPage
|
|||||||
->schema([
|
->schema([
|
||||||
FileUpload::make('image')
|
FileUpload::make('image')
|
||||||
->label('Image (700x525)')
|
->label('Image (700x525)')
|
||||||
->image() ->maxSize(2048)
|
->image()
|
||||||
|
->maxSize(2048)
|
||||||
->disk('public')
|
->disk('public')
|
||||||
->directory('portfolio-images')
|
->directory('portfolio-images')
|
||||||
->required(),
|
->required(),
|
||||||
|
|||||||
@@ -38,10 +38,12 @@ class ManageSite extends SettingsPage
|
|||||||
->maxLength(100),
|
->maxLength(100),
|
||||||
Forms\Components\TextInput::make('tagline')
|
Forms\Components\TextInput::make('tagline')
|
||||||
->label('Site Tagline')
|
->label('Site Tagline')
|
||||||
|
->required()
|
||||||
->helperText('A short phrase describing your site')
|
->helperText('A short phrase describing your site')
|
||||||
->maxLength(150),
|
->maxLength(150),
|
||||||
Forms\Components\Textarea::make('description')
|
Forms\Components\Textarea::make('description')
|
||||||
->label('Site Description')
|
->label('Site Description')
|
||||||
|
->required()
|
||||||
->helperText('A detailed description of your website')
|
->helperText('A detailed description of your website')
|
||||||
->rows(3)
|
->rows(3)
|
||||||
->maxLength(500),
|
->maxLength(500),
|
||||||
@@ -65,13 +67,16 @@ class ManageSite extends SettingsPage
|
|||||||
->maxLength(100),
|
->maxLength(100),
|
||||||
Forms\Components\TextInput::make('company_phone')
|
Forms\Components\TextInput::make('company_phone')
|
||||||
->label('Company Phone')
|
->label('Company Phone')
|
||||||
|
->required()
|
||||||
->maxLength(20),
|
->maxLength(20),
|
||||||
Forms\Components\TextInput::make('company_phone_2')
|
Forms\Components\TextInput::make('company_phone_2')
|
||||||
->label('Company Additional Phone')
|
->label('Company Additional Phone')
|
||||||
|
->required()
|
||||||
->maxLength(20),
|
->maxLength(20),
|
||||||
])->columns(2),
|
])->columns(2),
|
||||||
Forms\Components\Textarea::make('company_address')
|
Forms\Components\Textarea::make('company_address')
|
||||||
->label('Company Address')
|
->label('Company Address')
|
||||||
|
->required()
|
||||||
->rows(2)
|
->rows(2)
|
||||||
->maxLength(200),
|
->maxLength(200),
|
||||||
]),
|
]),
|
||||||
@@ -94,17 +99,20 @@ class ManageSite extends SettingsPage
|
|||||||
->schema([
|
->schema([
|
||||||
Forms\Components\TextInput::make('copyright_text')
|
Forms\Components\TextInput::make('copyright_text')
|
||||||
->label('Copyright Text')
|
->label('Copyright Text')
|
||||||
|
->required()
|
||||||
->maxLength(200),
|
->maxLength(200),
|
||||||
|
|
||||||
Forms\Components\Grid::make()->schema([
|
Forms\Components\Grid::make()->schema([
|
||||||
Forms\Components\TextInput::make('terms_url')
|
Forms\Components\TextInput::make('terms_url')
|
||||||
->label('Terms & Conditions URL')
|
->label('Terms & Conditions URL')
|
||||||
|
->required()
|
||||||
->maxLength(100)
|
->maxLength(100)
|
||||||
->prefix(function (Forms\Get $get) {
|
->prefix(function (Forms\Get $get) {
|
||||||
return url('/');
|
return url('/');
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('privacy_url')
|
Forms\Components\TextInput::make('privacy_url')
|
||||||
->label('Privacy Policy URL')
|
->label('Privacy Policy URL')
|
||||||
|
->required()
|
||||||
->maxLength(100)
|
->maxLength(100)
|
||||||
->prefix(function (Forms\Get $get) {
|
->prefix(function (Forms\Get $get) {
|
||||||
return url('/');
|
return url('/');
|
||||||
@@ -120,10 +128,12 @@ class ManageSite extends SettingsPage
|
|||||||
Forms\Components\Grid::make()->schema([
|
Forms\Components\Grid::make()->schema([
|
||||||
Forms\Components\Textarea::make('custom_404_message')
|
Forms\Components\Textarea::make('custom_404_message')
|
||||||
->label('404 Not Found Message')
|
->label('404 Not Found Message')
|
||||||
|
->required()
|
||||||
->rows(2)
|
->rows(2)
|
||||||
->maxLength(500),
|
->maxLength(500),
|
||||||
Forms\Components\Textarea::make('custom_500_message')
|
Forms\Components\Textarea::make('custom_500_message')
|
||||||
->label('500 Server Error Message')
|
->label('500 Server Error Message')
|
||||||
|
->required()
|
||||||
->rows(2)
|
->rows(2)
|
||||||
->maxLength(500),
|
->maxLength(500),
|
||||||
])->columns(2),
|
])->columns(2),
|
||||||
|
|||||||
@@ -28,18 +28,22 @@ class ManageSiteSocialSettings extends SettingsPage
|
|||||||
Forms\Components\Grid::make()->schema([
|
Forms\Components\Grid::make()->schema([
|
||||||
Forms\Components\TextInput::make('facebook_url')
|
Forms\Components\TextInput::make('facebook_url')
|
||||||
->label('Facebook URL')
|
->label('Facebook URL')
|
||||||
|
->required()
|
||||||
->prefix('https://')
|
->prefix('https://')
|
||||||
->helperText('e.g., facebook.com/yourpage'),
|
->helperText('e.g., facebook.com/yourpage'),
|
||||||
Forms\Components\TextInput::make('twitter_url')
|
Forms\Components\TextInput::make('twitter_url')
|
||||||
->label('Twitter/X URL')
|
->label('Twitter/X URL')
|
||||||
|
->required()
|
||||||
->prefix('https://')
|
->prefix('https://')
|
||||||
->helperText('e.g., twitter.com/yourusername'),
|
->helperText('e.g., twitter.com/yourusername'),
|
||||||
Forms\Components\TextInput::make('instagram_url')
|
Forms\Components\TextInput::make('instagram_url')
|
||||||
->label('Instagram URL')
|
->label('Instagram URL')
|
||||||
|
->required()
|
||||||
->prefix('https://')
|
->prefix('https://')
|
||||||
->helperText('e.g., instagram.com/yourusername'),
|
->helperText('e.g., instagram.com/yourusername'),
|
||||||
Forms\Components\TextInput::make('linkedin_url')
|
Forms\Components\TextInput::make('linkedin_url')
|
||||||
->label('LinkedIn URL')
|
->label('LinkedIn URL')
|
||||||
|
->required()
|
||||||
->prefix('https://')
|
->prefix('https://')
|
||||||
->helperText('e.g., linkedin.com/company/yourcompany'),
|
->helperText('e.g., linkedin.com/company/yourcompany'),
|
||||||
])->columns(2),
|
])->columns(2),
|
||||||
|
|||||||
@@ -4,12 +4,10 @@ namespace App\Filament\Pages;
|
|||||||
|
|
||||||
use App\Settings\SolutionSettings;
|
use App\Settings\SolutionSettings;
|
||||||
use Filament\Forms\Components\Grid;
|
use Filament\Forms\Components\Grid;
|
||||||
|
use Filament\Forms\Components\Repeater;
|
||||||
use Filament\Forms\Components\Section;
|
use Filament\Forms\Components\Section;
|
||||||
use Filament\Forms\Components\TextInput;
|
use Filament\Forms\Components\TextInput;
|
||||||
use Filament\Forms\Components\Textarea;
|
|
||||||
use Filament\Forms\Components\Repeater;
|
|
||||||
use Filament\Forms\Form;
|
use Filament\Forms\Form;
|
||||||
use Filament\Pages\Page;
|
|
||||||
use Filament\Pages\SettingsPage;
|
use Filament\Pages\SettingsPage;
|
||||||
use Illuminate\Contracts\Support\Htmlable;
|
use Illuminate\Contracts\Support\Htmlable;
|
||||||
|
|
||||||
@@ -29,6 +27,7 @@ class ManageSolutions extends SettingsPage
|
|||||||
->schema([
|
->schema([
|
||||||
TextInput::make('solutions_subtitle')
|
TextInput::make('solutions_subtitle')
|
||||||
->label('Subtitle')
|
->label('Subtitle')
|
||||||
|
->required()
|
||||||
->maxLength(100),
|
->maxLength(100),
|
||||||
TextInput::make('solutions_header')
|
TextInput::make('solutions_header')
|
||||||
->label('Header')
|
->label('Header')
|
||||||
@@ -37,9 +36,11 @@ class ManageSolutions extends SettingsPage
|
|||||||
Grid::make()->schema([
|
Grid::make()->schema([
|
||||||
TextInput::make('solutions_button_text')
|
TextInput::make('solutions_button_text')
|
||||||
->label('Button Text')
|
->label('Button Text')
|
||||||
|
->required()
|
||||||
->maxLength(50),
|
->maxLength(50),
|
||||||
TextInput::make('solutions_button_url')
|
TextInput::make('solutions_button_url')
|
||||||
->label('Button URL')
|
->label('Button URL')
|
||||||
|
->required()
|
||||||
->maxLength(255)
|
->maxLength(255)
|
||||||
->url(),
|
->url(),
|
||||||
])->columns(2),
|
])->columns(2),
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ namespace App\Filament\Pages;
|
|||||||
|
|
||||||
use App\Settings\SuccessSettings;
|
use App\Settings\SuccessSettings;
|
||||||
use Filament\Forms\Components\Grid;
|
use Filament\Forms\Components\Grid;
|
||||||
use Filament\Forms\Components\Section;
|
|
||||||
use Filament\Forms\Components\TextInput;
|
|
||||||
use Filament\Forms\Components\Textarea;
|
|
||||||
use Filament\Forms\Components\Repeater;
|
use Filament\Forms\Components\Repeater;
|
||||||
|
use Filament\Forms\Components\Section;
|
||||||
|
use Filament\Forms\Components\Textarea;
|
||||||
|
use Filament\Forms\Components\TextInput;
|
||||||
use Filament\Forms\Form;
|
use Filament\Forms\Form;
|
||||||
use Filament\Pages\SettingsPage;
|
use Filament\Pages\SettingsPage;
|
||||||
use Illuminate\Contracts\Support\Htmlable;
|
use Illuminate\Contracts\Support\Htmlable;
|
||||||
@@ -28,6 +28,7 @@ class ManageSuccess extends SettingsPage
|
|||||||
->schema([
|
->schema([
|
||||||
TextInput::make('success_subtitle')
|
TextInput::make('success_subtitle')
|
||||||
->label('Subtitle')
|
->label('Subtitle')
|
||||||
|
->required()
|
||||||
->maxLength(100),
|
->maxLength(100),
|
||||||
TextInput::make('success_header')
|
TextInput::make('success_header')
|
||||||
->label('Header')
|
->label('Header')
|
||||||
@@ -35,14 +36,17 @@ class ManageSuccess extends SettingsPage
|
|||||||
->maxLength(255),
|
->maxLength(255),
|
||||||
Textarea::make('success_paragraph')
|
Textarea::make('success_paragraph')
|
||||||
->label('Paragraph')
|
->label('Paragraph')
|
||||||
|
->required()
|
||||||
->rows(3)
|
->rows(3)
|
||||||
->maxLength(65535),
|
->maxLength(65535),
|
||||||
Grid::make()->schema([
|
Grid::make()->schema([
|
||||||
TextInput::make('success_button_text')
|
TextInput::make('success_button_text')
|
||||||
->label('Button Text')
|
->label('Button Text')
|
||||||
|
->required()
|
||||||
->maxLength(50),
|
->maxLength(50),
|
||||||
TextInput::make('success_button_url')
|
TextInput::make('success_button_url')
|
||||||
->label('Button URL')
|
->label('Button URL')
|
||||||
|
->required()
|
||||||
->maxLength(255)
|
->maxLength(255)
|
||||||
->url(),
|
->url(),
|
||||||
])->columns(2),
|
])->columns(2),
|
||||||
|
|||||||
@@ -3,9 +3,7 @@
|
|||||||
namespace App\Filament\Resources;
|
namespace App\Filament\Resources;
|
||||||
|
|
||||||
use App\Filament\Resources\BrandResource\Pages;
|
use App\Filament\Resources\BrandResource\Pages;
|
||||||
use App\Filament\Resources\BrandResource\RelationManagers;
|
|
||||||
use App\Models\Brand;
|
use App\Models\Brand;
|
||||||
use Filament\Forms;
|
|
||||||
use Filament\Forms\Components\FileUpload;
|
use Filament\Forms\Components\FileUpload;
|
||||||
use Filament\Forms\Components\TextInput;
|
use Filament\Forms\Components\TextInput;
|
||||||
use Filament\Forms\Components\Toggle;
|
use Filament\Forms\Components\Toggle;
|
||||||
@@ -16,8 +14,6 @@ use Filament\Tables\Columns\ImageColumn;
|
|||||||
use Filament\Tables\Columns\TextColumn;
|
use Filament\Tables\Columns\TextColumn;
|
||||||
use Filament\Tables\Columns\ToggleColumn;
|
use Filament\Tables\Columns\ToggleColumn;
|
||||||
use Filament\Tables\Table;
|
use Filament\Tables\Table;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
|
||||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
|
||||||
|
|
||||||
class BrandResource extends Resource
|
class BrandResource extends Resource
|
||||||
{
|
{
|
||||||
@@ -36,12 +32,12 @@ class BrandResource extends Resource
|
|||||||
FileUpload::make('image')
|
FileUpload::make('image')
|
||||||
->image()
|
->image()
|
||||||
->imageEditor()
|
->imageEditor()
|
||||||
->rules(['required', 'image',]),
|
->rules(['required', 'image']),
|
||||||
|
|
||||||
Toggle::make('active')
|
Toggle::make('active')
|
||||||
->label('Is active')
|
->label('Is active')
|
||||||
->onColor('success')
|
->onColor('success')
|
||||||
->offColor('danger')
|
->offColor('danger'),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
114
app/Filament/Resources/NewsResource.php
Normal file
114
app/Filament/Resources/NewsResource.php
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources;
|
||||||
|
|
||||||
|
use App\Filament\Resources\NewsResource\Pages;
|
||||||
|
use App\Models\News;
|
||||||
|
use Filament\Forms;
|
||||||
|
use Filament\Forms\Components\DateTimePicker;
|
||||||
|
use Filament\Forms\Components\FileUpload;
|
||||||
|
use Filament\Forms\Components\RichEditor;
|
||||||
|
use Filament\Forms\Components\TextInput;
|
||||||
|
use Filament\Forms\Form;
|
||||||
|
use Filament\Resources\Resource;
|
||||||
|
use Filament\Tables;
|
||||||
|
use Filament\Tables\Columns\ImageColumn;
|
||||||
|
use Filament\Tables\Table;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
class NewsResource extends Resource
|
||||||
|
{
|
||||||
|
protected static ?string $model = News::class;
|
||||||
|
|
||||||
|
protected static ?string $navigationIcon = 'heroicon-o-newspaper';
|
||||||
|
|
||||||
|
protected static ?string $navigationGroup = 'CMS';
|
||||||
|
|
||||||
|
public static function form(Form $form): Form
|
||||||
|
{
|
||||||
|
return $form
|
||||||
|
->schema([
|
||||||
|
Forms\Components\Card::make()
|
||||||
|
->schema([
|
||||||
|
TextInput::make('title')
|
||||||
|
->required()
|
||||||
|
->maxLength(255)
|
||||||
|
->reactive()
|
||||||
|
->afterStateUpdated(fn (string $operation, $state, Forms\Set $set) => $operation === 'create' ? $set('slug', Str::slug($state)) : null),
|
||||||
|
TextInput::make('slug')
|
||||||
|
->required()
|
||||||
|
->maxLength(255)
|
||||||
|
->disabled()
|
||||||
|
->dehydrated()
|
||||||
|
->unique(News::class, 'slug', ignoreRecord: true),
|
||||||
|
FileUpload::make('image')
|
||||||
|
->image()
|
||||||
|
->directory('news')
|
||||||
|
->nullable()
|
||||||
|
->columnSpanFull(),
|
||||||
|
RichEditor::make('content')
|
||||||
|
->required()
|
||||||
|
->columnSpanFull(),
|
||||||
|
DateTimePicker::make('published_at')
|
||||||
|
->required()
|
||||||
|
->default(now()),
|
||||||
|
])
|
||||||
|
->columns(2),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function table(Table $table): Table
|
||||||
|
{
|
||||||
|
return $table
|
||||||
|
->columns([
|
||||||
|
ImageColumn::make('image')
|
||||||
|
->square()
|
||||||
|
->toggleable(isToggledHiddenByDefault: true),
|
||||||
|
Tables\Columns\TextColumn::make('title')
|
||||||
|
->searchable()
|
||||||
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('slug')
|
||||||
|
->searchable()
|
||||||
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('published_at')
|
||||||
|
->dateTime()
|
||||||
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('created_at')
|
||||||
|
->dateTime()
|
||||||
|
->sortable()
|
||||||
|
->toggleable(isToggledHiddenByDefault: true),
|
||||||
|
Tables\Columns\TextColumn::make('updated_at')
|
||||||
|
->dateTime()
|
||||||
|
->sortable()
|
||||||
|
->toggleable(isToggledHiddenByDefault: true),
|
||||||
|
])
|
||||||
|
->filters([
|
||||||
|
//
|
||||||
|
])
|
||||||
|
->actions([
|
||||||
|
Tables\Actions\EditAction::make(),
|
||||||
|
Tables\Actions\DeleteAction::make(),
|
||||||
|
])
|
||||||
|
->bulkActions([
|
||||||
|
Tables\Actions\BulkActionGroup::make([
|
||||||
|
Tables\Actions\DeleteBulkAction::make(),
|
||||||
|
]),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getRelations(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
//
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getPages(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'index' => Pages\ListNews::route('/'),
|
||||||
|
'create' => Pages\CreateNews::route('/create'),
|
||||||
|
'edit' => Pages\EditNews::route('/{record}/edit'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
11
app/Filament/Resources/NewsResource/Pages/CreateNews.php
Normal file
11
app/Filament/Resources/NewsResource/Pages/CreateNews.php
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\NewsResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\NewsResource;
|
||||||
|
use Filament\Resources\Pages\CreateRecord;
|
||||||
|
|
||||||
|
class CreateNews extends CreateRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = NewsResource::class;
|
||||||
|
}
|
||||||
19
app/Filament/Resources/NewsResource/Pages/EditNews.php
Normal file
19
app/Filament/Resources/NewsResource/Pages/EditNews.php
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\NewsResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\NewsResource;
|
||||||
|
use Filament\Actions;
|
||||||
|
use Filament\Resources\Pages\EditRecord;
|
||||||
|
|
||||||
|
class EditNews extends EditRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = NewsResource::class;
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Actions\DeleteAction::make(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
19
app/Filament/Resources/NewsResource/Pages/ManageNews.php
Normal file
19
app/Filament/Resources/NewsResource/Pages/ManageNews.php
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\NewsResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\NewsResource;
|
||||||
|
use Filament\Actions;
|
||||||
|
use Filament\Resources\Pages\ListRecords;
|
||||||
|
|
||||||
|
class ListNews extends ListRecords
|
||||||
|
{
|
||||||
|
protected static string $resource = NewsResource::class;
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Actions\CreateAction::make(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
|
|
||||||
class BrandController extends Controller
|
class BrandController extends Controller
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use App\Models\Internship;
|
use App\Models\Internship;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
class InternshipsPageController extends Controller
|
class InternshipsPageController extends Controller
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,7 +8,9 @@ class NewsPageController extends Controller
|
|||||||
{
|
{
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
return view('web.pages.news.index');
|
$allNews = News::all();
|
||||||
|
|
||||||
|
return view('web.pages.news.index', compact('allNews'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function show(News $news)
|
public function show(News $news)
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ class OurSolutionPageController extends Controller
|
|||||||
{
|
{
|
||||||
return view('web.pages.our-solutions.index');
|
return view('web.pages.our-solutions.index');
|
||||||
}
|
}
|
||||||
public function show(Solution $solution)
|
|
||||||
|
|
||||||
|
public function show(Solution $solution)
|
||||||
{
|
{
|
||||||
return view('web.pages.our-solutions.show', compact('solution'));
|
return view('web.pages.our-solutions.show', compact('solution'));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ use Illuminate\Support\Facades\Storage;
|
|||||||
* @property int $id
|
* @property int $id
|
||||||
* @property string $name
|
* @property string $name
|
||||||
* @property string $image
|
* @property string $image
|
||||||
* @property boolean $active
|
* @property bool $active
|
||||||
* @property \Illuminate\Support\Facades\Date $created_at
|
* @property \Illuminate\Support\Facades\Date $created_at
|
||||||
* @property \Illuminate\Support\Facades\Date $updated_at
|
* @property \Illuminate\Support\Facades\Date $updated_at
|
||||||
*/
|
*/
|
||||||
@@ -17,6 +17,7 @@ class Brand extends Model
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Casts
|
* Casts
|
||||||
|
*
|
||||||
* @var array<string, string>
|
* @var array<string, string>
|
||||||
*/
|
*/
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
@@ -40,6 +41,6 @@ class Brand extends Model
|
|||||||
*/
|
*/
|
||||||
public function imageUrl(): string
|
public function imageUrl(): string
|
||||||
{
|
{
|
||||||
return url('/storage/' . $this->image);
|
return url('/storage/'.$this->image);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ class News extends Model
|
|||||||
'title',
|
'title',
|
||||||
'slug',
|
'slug',
|
||||||
'content',
|
'content',
|
||||||
|
'image',
|
||||||
'published_at',
|
'published_at',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -2,11 +2,9 @@
|
|||||||
|
|
||||||
namespace App\Providers;
|
namespace App\Providers;
|
||||||
|
|
||||||
use App\Models\Brand;
|
|
||||||
use App\Settings\SiteSettings;
|
use App\Settings\SiteSettings;
|
||||||
use App\Settings\SiteSocialSettings;
|
use App\Settings\SiteSocialSettings;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use App\Settings\HomeSettings;
|
|
||||||
use Illuminate\Support\Facades\View as ViewFacade;
|
use Illuminate\Support\Facades\View as ViewFacade;
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
use Illuminate\View\View;
|
use Illuminate\View\View;
|
||||||
|
|||||||
@@ -13,6 +13,11 @@ return new class extends Migration
|
|||||||
{
|
{
|
||||||
Schema::create('news', function (Blueprint $table) {
|
Schema::create('news', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
|
$table->string('title');
|
||||||
|
$table->string('slug')->unique();
|
||||||
|
$table->longText('content');
|
||||||
|
$table->string('image')->nullable();
|
||||||
|
$table->timestamp('published_at');
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
namespace Database\Seeders;
|
namespace Database\Seeders;
|
||||||
|
|
||||||
use App\Models\Brand;
|
use App\Models\Brand;
|
||||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
use Illuminate\Support\Facades\File;
|
use Illuminate\Support\Facades\File;
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace Database\Seeders;
|
namespace Database\Seeders;
|
||||||
|
|
||||||
use App\Models\User;
|
|
||||||
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
namespace Database\Seeders;
|
namespace Database\Seeders;
|
||||||
|
|
||||||
use Illuminate\Database\Seeder;
|
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
class UsersTableSeeder extends Seeder
|
class UsersTableSeeder extends Seeder
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -245,7 +245,7 @@
|
|||||||
@foreach($homeSettings->industry_items as $item)
|
@foreach($homeSettings->industry_items as $item)
|
||||||
<div class="col-md-6 md-mb-25 wow fadeInUp" data-wow-delay=".4s">
|
<div class="col-md-6 md-mb-25 wow fadeInUp" data-wow-delay=".4s">
|
||||||
<div class="industry__four-left-item borders pr-10 lg-pr-0">
|
<div class="industry__four-left-item borders pr-10 lg-pr-0">
|
||||||
<img src="/web/assets/img/icon/{{ $item['icon'] }}" alt="image">
|
<img src="/storage/{{ $item['icon'] }}" alt="image">
|
||||||
<h5>{{ $item['title'] }}</h5>
|
<h5>{{ $item['title'] }}</h5>
|
||||||
<p>{{ $item['description'] }}</p>
|
<p>{{ $item['description'] }}</p>
|
||||||
</div>
|
</div>
|
||||||
@@ -293,14 +293,14 @@
|
|||||||
<div class="sliders text_scroll">
|
<div class="sliders text_scroll">
|
||||||
<ul>
|
<ul>
|
||||||
@foreach($homeSettings->text_slide_items as $item)
|
@foreach($homeSettings->text_slide_items as $item)
|
||||||
<li><img src="/web/assets/img/icon/{{ $item['icon'] }}" alt="icon"><a href="{{ $item['link'] }}">{{ $item['text'] }}</a></li>
|
<li><img src="/storage/{{ $item['icon'] }}" alt="icon"><a href="{{ $item['link'] }}">{{ $item['text'] }}</a></li>
|
||||||
@endforeach
|
@endforeach
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="sliders text_scroll">
|
<div class="sliders text_scroll">
|
||||||
<ul>
|
<ul>
|
||||||
@foreach($homeSettings->text_slide_items as $item)
|
@foreach($homeSettings->text_slide_items as $item)
|
||||||
<li><img src="/web/assets/img/icon/{{ $item['icon'] }}" alt="icon"><a href="{{ $item['link'] }}">{{ $item['text'] }}</a></li>
|
<li><img src="/storage/{{ $item['icon'] }}" alt="icon"><a href="{{ $item['link'] }}">{{ $item['text'] }}</a></li>
|
||||||
@endforeach
|
@endforeach
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1 +1,128 @@
|
|||||||
w
|
@extends('web.layouts.app')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<!-- Breadcrumb Area Start -->
|
||||||
|
<div class="breadcrumb__area" style="background-image: url('assets/img/page/breadcrumb.jpg');">
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xl-12">
|
||||||
|
<div class="breadcrumb__area-content">
|
||||||
|
<h2>Blog 3 Columns</h2>
|
||||||
|
<ul>
|
||||||
|
<li><a href="index.html">Home</a><i class="fa-regular fa-angle-right"></i></li>
|
||||||
|
<li>Blog 3 Columns</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- Breadcrumb Area End -->
|
||||||
|
<!-- Blog Area Start -->
|
||||||
|
<div class="blog-three__columns section-padding-three">
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
@foreach ($allNews as $news)
|
||||||
|
<div class="col-xl-4 col-lg-6 wow fadeInUp" data-wow-delay=".4s">
|
||||||
|
<div class="blog__one-item">
|
||||||
|
<div class="blog__one-item-image">
|
||||||
|
<a href="{{ route('news.show', $news->slug) }}"><img src="assets/img/blog/blog-1.jpg" alt="image"></a>
|
||||||
|
<div class="blog__one-item-image-date">
|
||||||
|
<h6><i class="fa-regular fa-calendar"></i>{{ \Carbon\Carbon::parse($news->published_at)->format('d M') }}</h6>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="blog__one-item-content">
|
||||||
|
<h4><a href="{{ route('news.show', $news->slug) }}">{{ $news->title }}</a></h4>
|
||||||
|
<a class="more_btn" href="{{ route('news.show', $news->slug) }}">Read More<i class="flaticon-right-up"></i></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endforeach
|
||||||
|
<div class="col-xl-4 col-lg-6 wow fadeInUp" data-wow-delay=".7s">
|
||||||
|
<div class="blog__one-item">
|
||||||
|
<div class="blog__one-item-image">
|
||||||
|
<a href="blog-details.html"><img src="assets/img/blog/blog-2.jpg" alt="image"></a>
|
||||||
|
<div class="blog__one-item-image-date">
|
||||||
|
<h6><i class="fa-regular fa-calendar"></i>19 Dec</h6>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="blog__one-item-content">
|
||||||
|
<h4><a href="blog-details.html">How to Choose the Perfect Construction Company</a></h4>
|
||||||
|
<a class="more_btn" href="blog-details.html">Read More<i class="flaticon-right-up"></i></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-xl-4 col-lg-6 wow fadeInUp" data-wow-delay="1s">
|
||||||
|
<div class="blog__one-item">
|
||||||
|
<div class="blog__one-item-image">
|
||||||
|
<a href="blog-details.html"><img src="assets/img/blog/blog-3.jpg" alt="image"></a>
|
||||||
|
<div class="blog__one-item-image-date">
|
||||||
|
<h6><i class="fa-regular fa-calendar"></i>14 Dec</h6>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="blog__one-item-content">
|
||||||
|
<h4><a href="blog-details.html">Top Mistakes to Avoid During Home Renovation</a></h4>
|
||||||
|
<a class="more_btn" href="blog-details.html">Read More<i class="flaticon-right-up"></i></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-xl-4 col-lg-6 wow fadeInUp" data-wow-delay=".4s">
|
||||||
|
<div class="blog__one-item">
|
||||||
|
<div class="blog__one-item-image">
|
||||||
|
<a href="blog-details.html"><img src="assets/img/blog/blog-6.jpg" alt="image"></a>
|
||||||
|
<div class="blog__one-item-image-date">
|
||||||
|
<h6><i class="fa-regular fa-calendar"></i>22 Dec</h6>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="blog__one-item-content">
|
||||||
|
<h4><a href="blog-details.html">Key Steps to Ensure a Smooth Building Process</a></h4>
|
||||||
|
<a class="more_btn" href="blog-details.html">Read More<i class="flaticon-right-up"></i></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-xl-4 col-lg-6 wow fadeInUp" data-wow-delay=".7s">
|
||||||
|
<div class="blog__one-item">
|
||||||
|
<div class="blog__one-item-image">
|
||||||
|
<a href="blog-details.html"><img src="assets/img/blog/blog-5.jpg" alt="image"></a>
|
||||||
|
<div class="blog__one-item-image-date">
|
||||||
|
<h6><i class="fa-regular fa-calendar"></i>24 Dec</h6>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="blog__one-item-content">
|
||||||
|
<h4><a href="blog-details.html">How to Maximize Space in Your Commercial Building</a></h4>
|
||||||
|
<a class="more_btn" href="blog-details.html">Read More<i class="flaticon-right-up"></i></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-xl-4 col-lg-6 wow fadeInUp" data-wow-delay="1s">
|
||||||
|
<div class="blog__one-item">
|
||||||
|
<div class="blog__one-item-image">
|
||||||
|
<a href="blog-details.html"><img src="assets/img/blog/blog-4.jpg" alt="image"></a>
|
||||||
|
<div class="blog__one-item-image-date">
|
||||||
|
<h6><i class="fa-regular fa-calendar"></i>25 Dec</h6>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="blog__one-item-content">
|
||||||
|
<h4><a href="blog-details.html">The Future of Smart Homes in Construction</a></h4>
|
||||||
|
<a class="more_btn" href="blog-details.html">Read More<i class="flaticon-right-up"></i></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row mt-25">
|
||||||
|
<div class="col-xl-12">
|
||||||
|
<div class="theme__pagination t-center">
|
||||||
|
<ul>
|
||||||
|
<li><a class="active" href="#">01</a></li>
|
||||||
|
<li><a href="#">02</a></li>
|
||||||
|
<li><a href="#"><i class="far fa-ellipsis-h"></i></a></li>
|
||||||
|
<li><a href="#">05</a></li>
|
||||||
|
<li><a href="#"><i class="fa-regular fa-angle-right"></i></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- Blog Area End -->
|
||||||
|
@endsection
|
||||||
Reference in New Issue
Block a user