migrate template
This commit is contained in:
111
app/Filament/Pages/SiteSettingsPage.php
Normal file
111
app/Filament/Pages/SiteSettingsPage.php
Normal file
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Pages;
|
||||
|
||||
use App\Models\SiteSetting;
|
||||
use BackedEnum;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Pages\Page;
|
||||
use Filament\Schemas\Components\Form;
|
||||
use Filament\Schemas\Components\Tabs;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
|
||||
class SiteSettingsPage extends Page
|
||||
{
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedCog6Tooth;
|
||||
|
||||
protected static ?string $navigationLabel = 'Sahypa sazlamalary';
|
||||
|
||||
protected static \UnitEnum|string|null $navigationGroup = null;
|
||||
|
||||
protected static ?int $navigationSort = 10;
|
||||
|
||||
protected string $view = 'filament.pages.site-settings-page';
|
||||
|
||||
/** @var array<string, mixed>|null */
|
||||
public ?array $data = [];
|
||||
|
||||
public function mount(): void
|
||||
{
|
||||
$this->data = SiteSetting::pluck('value', 'key')->toArray();
|
||||
$this->form->fill($this->data);
|
||||
}
|
||||
|
||||
public function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->statePath('data')
|
||||
->components([
|
||||
Form::make()
|
||||
->schema([
|
||||
Tabs::make()
|
||||
->tabs([
|
||||
Tabs\Tab::make('Kesimçiniň hekaýasy')
|
||||
->schema([
|
||||
TextInput::make('butchers_tale_title')
|
||||
->label('Bölüm başlygy')
|
||||
->required(),
|
||||
Textarea::make('butchers_tale_body')
|
||||
->label('Tekst')
|
||||
->rows(5)
|
||||
->columnSpanFull(),
|
||||
FileUpload::make('butchers_tale_image')
|
||||
->label('Surat (gollar)')
|
||||
->image()
|
||||
->disk('public')
|
||||
->directory('settings')
|
||||
->columnSpanFull(),
|
||||
]),
|
||||
Tabs\Tab::make('Footer')
|
||||
->schema([
|
||||
TextInput::make('footer_brand_name')
|
||||
->label('Brend ady')
|
||||
->required(),
|
||||
TextInput::make('footer_copyright')
|
||||
->label('Awtorlyk hukugy ýazgysy')
|
||||
->required()
|
||||
->columnSpanFull(),
|
||||
TextInput::make('footer_address')
|
||||
->label('Salgy'),
|
||||
TextInput::make('footer_email')
|
||||
->label('E-poçta')
|
||||
->email(),
|
||||
TextInput::make('footer_phone')
|
||||
->label('Telefon')
|
||||
->tel(),
|
||||
]),
|
||||
])
|
||||
->columnSpanFull(),
|
||||
])
|
||||
->columnSpanFull(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function save(): void
|
||||
{
|
||||
$state = $this->form->getState();
|
||||
|
||||
foreach ($state as $key => $value) {
|
||||
SiteSetting::updateOrCreate(['key' => $key], ['value' => $value]);
|
||||
}
|
||||
|
||||
Notification::make()
|
||||
->title('Sazlamalar saklanyldy.')
|
||||
->success()
|
||||
->send();
|
||||
}
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Action::make('save')
|
||||
->label('Saklamak')
|
||||
->action('save'),
|
||||
];
|
||||
}
|
||||
}
|
||||
104
app/Filament/Resources/Categories/CategoryResource.php
Normal file
104
app/Filament/Resources/Categories/CategoryResource.php
Normal file
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Categories;
|
||||
|
||||
use App\Filament\Resources\Categories\Pages\ManageCategories;
|
||||
use App\Models\Category;
|
||||
use BackedEnum;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class CategoryResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Category::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedSquares2x2;
|
||||
|
||||
protected static ?string $navigationLabel = 'Kategoriýalar';
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Harytlar';
|
||||
|
||||
protected static ?int $navigationSort = 1;
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('name')
|
||||
->label('Ady')
|
||||
->required()
|
||||
->live(onBlur: true),
|
||||
TextInput::make('slug')
|
||||
->label('Slug')
|
||||
->required()
|
||||
->unique(ignoreRecord: true),
|
||||
TextInput::make('icon')
|
||||
->label('Material Symbol ikony')
|
||||
->required()
|
||||
->default('category')
|
||||
->placeholder('set_meal'),
|
||||
TextInput::make('sort_order')
|
||||
->label('Tertip')
|
||||
->required()
|
||||
->numeric()
|
||||
->default(0),
|
||||
Toggle::make('is_active')
|
||||
->label('Işjeň')
|
||||
->default(true),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('name')
|
||||
->label('Ady')
|
||||
->searchable(),
|
||||
TextColumn::make('slug')
|
||||
->label('Slug')
|
||||
->searchable(),
|
||||
TextColumn::make('icon')
|
||||
->label('Ikony'),
|
||||
TextColumn::make('sort_order')
|
||||
->label('Tertip')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
IconColumn::make('is_active')
|
||||
->label('Işjeň')
|
||||
->boolean(),
|
||||
TextColumn::make('created_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->defaultSort('sort_order')
|
||||
->filters([])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
DeleteAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ManageCategories::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
19
app/Filament/Resources/Categories/Pages/ManageCategories.php
Normal file
19
app/Filament/Resources/Categories/Pages/ManageCategories.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Categories\Pages;
|
||||
|
||||
use App\Filament\Resources\Categories\CategoryResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ManageRecords;
|
||||
|
||||
class ManageCategories extends ManageRecords
|
||||
{
|
||||
protected static string $resource = CategoryResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\FooterNavLinks;
|
||||
|
||||
use App\Filament\Resources\FooterNavLinks\Pages\ManageFooterNavLinks;
|
||||
use App\Models\FooterNavLink;
|
||||
use BackedEnum;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class FooterNavLinkResource extends Resource
|
||||
{
|
||||
protected static ?string $model = FooterNavLink::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedLink;
|
||||
|
||||
protected static ?string $navigationLabel = 'Footer baglanyşyklary';
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Sahypa mazmunu';
|
||||
|
||||
protected static ?int $navigationSort = 4;
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('label')
|
||||
->label('Ýazgy')
|
||||
->required(),
|
||||
TextInput::make('url')
|
||||
->label('URL')
|
||||
->required()
|
||||
->url(),
|
||||
TextInput::make('sort_order')
|
||||
->label('Tertip')
|
||||
->required()
|
||||
->numeric()
|
||||
->default(0),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('label')
|
||||
->label('Ýazgy')
|
||||
->searchable(),
|
||||
TextColumn::make('url')
|
||||
->label('URL')
|
||||
->searchable(),
|
||||
TextColumn::make('sort_order')
|
||||
->label('Tertip')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
TextColumn::make('created_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->defaultSort('sort_order')
|
||||
->filters([])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
DeleteAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ManageFooterNavLinks::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\FooterNavLinks\Pages;
|
||||
|
||||
use App\Filament\Resources\FooterNavLinks\FooterNavLinkResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ManageRecords;
|
||||
|
||||
class ManageFooterNavLinks extends ManageRecords
|
||||
{
|
||||
protected static string $resource = FooterNavLinkResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
115
app/Filament/Resources/HeroSlides/HeroSlideResource.php
Normal file
115
app/Filament/Resources/HeroSlides/HeroSlideResource.php
Normal file
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\HeroSlides;
|
||||
|
||||
use App\Filament\Resources\HeroSlides\Pages\ManageHeroSlides;
|
||||
use App\Models\HeroSlide;
|
||||
use BackedEnum;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\ImageColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class HeroSlideResource extends Resource
|
||||
{
|
||||
protected static ?string $model = HeroSlide::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedPhoto;
|
||||
|
||||
protected static ?string $navigationLabel = 'Hero Slaýdlary';
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Sahypa mazmunu';
|
||||
|
||||
protected static ?int $navigationSort = 1;
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('headline')
|
||||
->label('Sözbaşy')
|
||||
->required()
|
||||
->columnSpanFull(),
|
||||
Textarea::make('subheadline')
|
||||
->label('Ikinji sözbaşy')
|
||||
->rows(2)
|
||||
->columnSpanFull(),
|
||||
TextInput::make('cta_label')
|
||||
->label('Düwme ýazgysy'),
|
||||
TextInput::make('cta_url')
|
||||
->label('Düwme URL')
|
||||
->url(),
|
||||
FileUpload::make('image')
|
||||
->label('Surat')
|
||||
->image()
|
||||
->disk('public')
|
||||
->directory('hero-slides')
|
||||
->columnSpanFull(),
|
||||
TextInput::make('sort_order')
|
||||
->label('Tertip')
|
||||
->required()
|
||||
->numeric()
|
||||
->default(0),
|
||||
Toggle::make('is_active')
|
||||
->label('Işjeň')
|
||||
->default(true),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
ImageColumn::make('image')
|
||||
->label('Surat')
|
||||
->square(),
|
||||
TextColumn::make('headline')
|
||||
->label('Sözbaşy')
|
||||
->searchable()
|
||||
->limit(40),
|
||||
TextColumn::make('cta_label')
|
||||
->label('Düwme')
|
||||
->searchable(),
|
||||
TextColumn::make('sort_order')
|
||||
->label('Tertip')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
IconColumn::make('is_active')
|
||||
->label('Işjeň')
|
||||
->boolean(),
|
||||
TextColumn::make('created_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->defaultSort('sort_order')
|
||||
->filters([])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
DeleteAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ManageHeroSlides::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
19
app/Filament/Resources/HeroSlides/Pages/ManageHeroSlides.php
Normal file
19
app/Filament/Resources/HeroSlides/Pages/ManageHeroSlides.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\HeroSlides\Pages;
|
||||
|
||||
use App\Filament\Resources\HeroSlides\HeroSlideResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ManageRecords;
|
||||
|
||||
class ManageHeroSlides extends ManageRecords
|
||||
{
|
||||
protected static string $resource = HeroSlideResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
19
app/Filament/Resources/Products/Pages/ManageProducts.php
Normal file
19
app/Filament/Resources/Products/Pages/ManageProducts.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Products\Pages;
|
||||
|
||||
use App\Filament\Resources\Products\ProductResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ManageRecords;
|
||||
|
||||
class ManageProducts extends ManageRecords
|
||||
{
|
||||
protected static string $resource = ProductResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
172
app/Filament/Resources/Products/ProductResource.php
Normal file
172
app/Filament/Resources/Products/ProductResource.php
Normal file
@@ -0,0 +1,172 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Products;
|
||||
|
||||
use App\Filament\Resources\Products\Pages\ManageProducts;
|
||||
use App\Models\Product;
|
||||
use BackedEnum;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\ImageColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class ProductResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Product::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedShoppingBag;
|
||||
|
||||
protected static ?string $navigationLabel = 'Harytlar';
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Harytlar';
|
||||
|
||||
protected static ?int $navigationSort = 2;
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
Select::make('category_id')
|
||||
->label('Kategoriýa')
|
||||
->relationship('category', 'name')
|
||||
->required()
|
||||
->searchable()
|
||||
->preload(),
|
||||
TextInput::make('name')
|
||||
->label('Ady')
|
||||
->required(),
|
||||
TextInput::make('slug')
|
||||
->label('Slug')
|
||||
->required()
|
||||
->unique(ignoreRecord: true),
|
||||
TextInput::make('price')
|
||||
->label('Bahasy')
|
||||
->required()
|
||||
->numeric()
|
||||
->prefix('TMT'),
|
||||
TextInput::make('price_unit')
|
||||
->label('Baha birligi')
|
||||
->required()
|
||||
->default('kg')
|
||||
->placeholder('kg, sany, gram'),
|
||||
Select::make('availability_status')
|
||||
->label('Elýeterliligi')
|
||||
->required()
|
||||
->options([
|
||||
'available' => 'Elýeterli',
|
||||
'out_of_season' => 'Möwsümden daşary',
|
||||
'low_stock' => 'Az galdy',
|
||||
])
|
||||
->default('available'),
|
||||
Textarea::make('description')
|
||||
->label('Beýany')
|
||||
->rows(3)
|
||||
->columnSpanFull(),
|
||||
FileUpload::make('image')
|
||||
->label('Surat')
|
||||
->image()
|
||||
->disk('public')
|
||||
->directory('products')
|
||||
->columnSpanFull(),
|
||||
TextInput::make('sort_order')
|
||||
->label('Tertip')
|
||||
->required()
|
||||
->numeric()
|
||||
->default(0),
|
||||
Toggle::make('is_active')
|
||||
->label('Işjeň')
|
||||
->default(true),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
ImageColumn::make('image')
|
||||
->label('Surat')
|
||||
->square(),
|
||||
TextColumn::make('name')
|
||||
->label('Ady')
|
||||
->searchable(),
|
||||
TextColumn::make('category.name')
|
||||
->label('Kategoriýa')
|
||||
->badge()
|
||||
->sortable(),
|
||||
TextColumn::make('price')
|
||||
->label('Bahasy')
|
||||
->formatStateUsing(fn ($state) => number_format($state, 2).' TMT')
|
||||
->sortable(),
|
||||
TextColumn::make('price_unit')
|
||||
->label('Birlik'),
|
||||
TextColumn::make('availability_status')
|
||||
->label('Elýeterliligi')
|
||||
->badge()
|
||||
->color(fn (string $state): string => match ($state) {
|
||||
'available' => 'success',
|
||||
'out_of_season' => 'warning',
|
||||
'low_stock' => 'danger',
|
||||
default => 'gray',
|
||||
})
|
||||
->formatStateUsing(fn (string $state): string => match ($state) {
|
||||
'available' => 'Elýeterli',
|
||||
'out_of_season' => 'Möwsümden daşary',
|
||||
'low_stock' => 'Az galdy',
|
||||
default => $state,
|
||||
}),
|
||||
IconColumn::make('is_active')
|
||||
->label('Işjeň')
|
||||
->boolean(),
|
||||
TextColumn::make('sort_order')
|
||||
->label('Tertip')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
TextColumn::make('created_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->defaultSort('sort_order')
|
||||
->filters([
|
||||
SelectFilter::make('category')
|
||||
->relationship('category', 'name')
|
||||
->label('Kategoriýa'),
|
||||
SelectFilter::make('availability_status')
|
||||
->options([
|
||||
'available' => 'Elýeterli',
|
||||
'out_of_season' => 'Möwsümden daşary',
|
||||
'low_stock' => 'Az galdy',
|
||||
])
|
||||
->label('Elýeterliligi'),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
DeleteAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ManageProducts::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\SignatureItems\Pages;
|
||||
|
||||
use App\Filament\Resources\SignatureItems\SignatureItemResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ManageRecords;
|
||||
|
||||
class ManageSignatureItems extends ManageRecords
|
||||
{
|
||||
protected static string $resource = SignatureItemResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
120
app/Filament/Resources/SignatureItems/SignatureItemResource.php
Normal file
120
app/Filament/Resources/SignatureItems/SignatureItemResource.php
Normal file
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\SignatureItems;
|
||||
|
||||
use App\Filament\Resources\SignatureItems\Pages\ManageSignatureItems;
|
||||
use App\Models\SignatureItem;
|
||||
use BackedEnum;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\ImageColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class SignatureItemResource extends Resource
|
||||
{
|
||||
protected static ?string $model = SignatureItem::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedStar;
|
||||
|
||||
protected static ?string $navigationLabel = 'Aýratynlyklar';
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Sahypa mazmunu';
|
||||
|
||||
protected static ?int $navigationSort = 2;
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('name')
|
||||
->label('Ady')
|
||||
->required(),
|
||||
TextInput::make('price')
|
||||
->label('Bahasy')
|
||||
->required()
|
||||
->numeric()
|
||||
->prefix('TMT'),
|
||||
TextInput::make('price_unit')
|
||||
->label('Baha birligi')
|
||||
->required()
|
||||
->default('kg'),
|
||||
TextInput::make('sort_order')
|
||||
->label('Tertip')
|
||||
->required()
|
||||
->numeric()
|
||||
->default(0),
|
||||
Toggle::make('is_active')
|
||||
->label('Işjeň')
|
||||
->default(true),
|
||||
Textarea::make('description')
|
||||
->label('Beýany')
|
||||
->rows(3)
|
||||
->columnSpanFull(),
|
||||
FileUpload::make('image')
|
||||
->label('Surat')
|
||||
->image()
|
||||
->disk('public')
|
||||
->directory('signature-items')
|
||||
->columnSpanFull(),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
ImageColumn::make('image')
|
||||
->label('Surat')
|
||||
->square(),
|
||||
TextColumn::make('name')
|
||||
->label('Ady')
|
||||
->searchable(),
|
||||
TextColumn::make('price')
|
||||
->label('Bahasy')
|
||||
->formatStateUsing(fn ($state) => number_format($state, 2).' TMT / ')
|
||||
->sortable(),
|
||||
TextColumn::make('price_unit')
|
||||
->label('Birlik'),
|
||||
IconColumn::make('is_active')
|
||||
->label('Işjeň')
|
||||
->boolean(),
|
||||
TextColumn::make('sort_order')
|
||||
->label('Tertip')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
TextColumn::make('created_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->defaultSort('sort_order')
|
||||
->filters([])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
DeleteAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ManageSignatureItems::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\SocialLinks\Pages;
|
||||
|
||||
use App\Filament\Resources\SocialLinks\SocialLinkResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ManageRecords;
|
||||
|
||||
class ManageSocialLinks extends ManageRecords
|
||||
{
|
||||
protected static string $resource = SocialLinkResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
95
app/Filament/Resources/SocialLinks/SocialLinkResource.php
Normal file
95
app/Filament/Resources/SocialLinks/SocialLinkResource.php
Normal file
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\SocialLinks;
|
||||
|
||||
use App\Filament\Resources\SocialLinks\Pages\ManageSocialLinks;
|
||||
use App\Models\SocialLink;
|
||||
use BackedEnum;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class SocialLinkResource extends Resource
|
||||
{
|
||||
protected static ?string $model = SocialLink::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedShare;
|
||||
|
||||
protected static ?string $navigationLabel = 'Sosial mediýa';
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Sahypa mazmunu';
|
||||
|
||||
protected static ?int $navigationSort = 5;
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('platform')
|
||||
->label('Platforma')
|
||||
->required()
|
||||
->placeholder('Instagram'),
|
||||
TextInput::make('url')
|
||||
->label('URL')
|
||||
->required(),
|
||||
TextInput::make('icon')
|
||||
->label('Material Symbol ikony')
|
||||
->required()
|
||||
->default('link')
|
||||
->placeholder('photo_camera'),
|
||||
TextInput::make('sort_order')
|
||||
->label('Tertip')
|
||||
->required()
|
||||
->numeric()
|
||||
->default(0),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('platform')
|
||||
->label('Platforma')
|
||||
->searchable(),
|
||||
TextColumn::make('icon')
|
||||
->label('Ikony'),
|
||||
TextColumn::make('url')
|
||||
->label('URL')
|
||||
->searchable(),
|
||||
TextColumn::make('sort_order')
|
||||
->label('Tertip')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
TextColumn::make('created_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->defaultSort('sort_order')
|
||||
->filters([])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
DeleteAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ManageSocialLinks::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\TimelineEntries\Pages;
|
||||
|
||||
use App\Filament\Resources\TimelineEntries\TimelineEntryResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ManageRecords;
|
||||
|
||||
class ManageTimelineEntries extends ManageRecords
|
||||
{
|
||||
protected static string $resource = TimelineEntryResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
103
app/Filament/Resources/TimelineEntries/TimelineEntryResource.php
Normal file
103
app/Filament/Resources/TimelineEntries/TimelineEntryResource.php
Normal file
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\TimelineEntries;
|
||||
|
||||
use App\Filament\Resources\TimelineEntries\Pages\ManageTimelineEntries;
|
||||
use App\Models\TimelineEntry;
|
||||
use BackedEnum;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class TimelineEntryResource extends Resource
|
||||
{
|
||||
protected static ?string $model = TimelineEntry::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedClock;
|
||||
|
||||
protected static ?string $navigationLabel = 'Taryh';
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Sahypa mazmunu';
|
||||
|
||||
protected static ?int $navigationSort = 3;
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('year')
|
||||
->label('Ýyly')
|
||||
->required()
|
||||
->numeric()
|
||||
->minValue(1900)
|
||||
->maxValue(2100),
|
||||
TextInput::make('title')
|
||||
->label('Başlyk')
|
||||
->required(),
|
||||
TextInput::make('icon')
|
||||
->label('Material Symbol ikony')
|
||||
->required()
|
||||
->default('history')
|
||||
->placeholder('storefront'),
|
||||
TextInput::make('sort_order')
|
||||
->label('Tertip')
|
||||
->required()
|
||||
->numeric()
|
||||
->default(0),
|
||||
Textarea::make('body')
|
||||
->label('Tekst')
|
||||
->required()
|
||||
->rows(3)
|
||||
->columnSpanFull(),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('year')
|
||||
->label('Ýyly')
|
||||
->sortable(),
|
||||
TextColumn::make('title')
|
||||
->label('Başlyk')
|
||||
->searchable(),
|
||||
TextColumn::make('icon')
|
||||
->label('Ikony'),
|
||||
TextColumn::make('sort_order')
|
||||
->label('Tertip')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
TextColumn::make('created_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->defaultSort('sort_order')
|
||||
->filters([])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
DeleteAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ManageTimelineEntries::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
53
app/Http/Controllers/HomeController.php
Normal file
53
app/Http/Controllers/HomeController.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Category;
|
||||
use App\Models\FooterNavLink;
|
||||
use App\Models\HeroSlide;
|
||||
use App\Models\SignatureItem;
|
||||
use App\Models\SiteSetting;
|
||||
use App\Models\SocialLink;
|
||||
use App\Models\TimelineEntry;
|
||||
use Illuminate\Contracts\View\View;
|
||||
|
||||
class HomeController extends Controller
|
||||
{
|
||||
public function index(): View
|
||||
{
|
||||
$heroSlides = HeroSlide::where('is_active', true)
|
||||
->orderBy('sort_order')
|
||||
->get();
|
||||
|
||||
$categories = Category::where('is_active', true)
|
||||
->orderBy('sort_order')
|
||||
->with([
|
||||
'products' => fn ($query) => $query
|
||||
->where('is_active', true)
|
||||
->orderBy('sort_order'),
|
||||
])
|
||||
->get();
|
||||
|
||||
$signatureItems = SignatureItem::where('is_active', true)
|
||||
->orderBy('sort_order')
|
||||
->get();
|
||||
|
||||
$timelineEntries = TimelineEntry::orderBy('sort_order')->get();
|
||||
|
||||
$footerNavLinks = FooterNavLink::orderBy('sort_order')->get();
|
||||
|
||||
$socialLinks = SocialLink::orderBy('sort_order')->get();
|
||||
|
||||
$settings = SiteSetting::pluck('value', 'key');
|
||||
|
||||
return view('welcome', compact(
|
||||
'heroSlides',
|
||||
'categories',
|
||||
'signatureItems',
|
||||
'timelineEntries',
|
||||
'footerNavLinks',
|
||||
'socialLinks',
|
||||
'settings',
|
||||
));
|
||||
}
|
||||
}
|
||||
50
app/Models/Category.php
Normal file
50
app/Models/Category.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Database\Factories\CategoryFactory;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class Category extends Model
|
||||
{
|
||||
/** @use HasFactory<CategoryFactory> */
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'slug',
|
||||
'icon',
|
||||
'sort_order',
|
||||
'is_active',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'is_active' => 'boolean',
|
||||
'sort_order' => 'integer',
|
||||
];
|
||||
}
|
||||
|
||||
protected static function booted(): void
|
||||
{
|
||||
static::saving(function (Category $category): void {
|
||||
if (empty($category->slug)) {
|
||||
$category->slug = Str::slug($category->name);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function products(): HasMany
|
||||
{
|
||||
return $this->hasMany(Product::class);
|
||||
}
|
||||
|
||||
public function scopeActive($query): void
|
||||
{
|
||||
$query->where('is_active', true);
|
||||
}
|
||||
}
|
||||
26
app/Models/FooterNavLink.php
Normal file
26
app/Models/FooterNavLink.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Database\Factories\FooterNavLinkFactory;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class FooterNavLink extends Model
|
||||
{
|
||||
/** @use HasFactory<FooterNavLinkFactory> */
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'label',
|
||||
'url',
|
||||
'sort_order',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'sort_order' => 'integer',
|
||||
];
|
||||
}
|
||||
}
|
||||
36
app/Models/HeroSlide.php
Normal file
36
app/Models/HeroSlide.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Database\Factories\HeroSlideFactory;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class HeroSlide extends Model
|
||||
{
|
||||
/** @use HasFactory<HeroSlideFactory> */
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'headline',
|
||||
'subheadline',
|
||||
'cta_label',
|
||||
'cta_url',
|
||||
'image',
|
||||
'sort_order',
|
||||
'is_active',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'is_active' => 'boolean',
|
||||
'sort_order' => 'integer',
|
||||
];
|
||||
}
|
||||
|
||||
public function scopeActive($query): void
|
||||
{
|
||||
$query->where('is_active', true);
|
||||
}
|
||||
}
|
||||
61
app/Models/Product.php
Normal file
61
app/Models/Product.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Database\Factories\ProductFactory;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class Product extends Model
|
||||
{
|
||||
/** @use HasFactory<ProductFactory> */
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'category_id',
|
||||
'name',
|
||||
'slug',
|
||||
'price',
|
||||
'price_unit',
|
||||
'description',
|
||||
'image',
|
||||
'availability_status',
|
||||
'is_active',
|
||||
'sort_order',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'price' => 'decimal:2',
|
||||
'is_active' => 'boolean',
|
||||
'sort_order' => 'integer',
|
||||
];
|
||||
}
|
||||
|
||||
protected static function booted(): void
|
||||
{
|
||||
static::saving(function (Product $product): void {
|
||||
if (empty($product->slug)) {
|
||||
$product->slug = Str::slug($product->name);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function category(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Category::class);
|
||||
}
|
||||
|
||||
public function scopeActive($query): void
|
||||
{
|
||||
$query->where('is_active', true);
|
||||
}
|
||||
|
||||
public function isAvailable(): bool
|
||||
{
|
||||
return $this->availability_status === 'available';
|
||||
}
|
||||
}
|
||||
37
app/Models/SignatureItem.php
Normal file
37
app/Models/SignatureItem.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Database\Factories\SignatureItemFactory;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class SignatureItem extends Model
|
||||
{
|
||||
/** @use HasFactory<SignatureItemFactory> */
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'price',
|
||||
'price_unit',
|
||||
'description',
|
||||
'image',
|
||||
'sort_order',
|
||||
'is_active',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'price' => 'decimal:2',
|
||||
'is_active' => 'boolean',
|
||||
'sort_order' => 'integer',
|
||||
];
|
||||
}
|
||||
|
||||
public function scopeActive($query): void
|
||||
{
|
||||
$query->where('is_active', true);
|
||||
}
|
||||
}
|
||||
49
app/Models/SiteSetting.php
Normal file
49
app/Models/SiteSetting.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Database\Factories\SiteSettingFactory;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
class SiteSetting extends Model
|
||||
{
|
||||
/** @use HasFactory<SiteSettingFactory> */
|
||||
use HasFactory;
|
||||
|
||||
protected $primaryKey = 'key';
|
||||
|
||||
public $incrementing = false;
|
||||
|
||||
protected $keyType = 'string';
|
||||
|
||||
protected $fillable = [
|
||||
'key',
|
||||
'value',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get a setting value by key.
|
||||
*/
|
||||
public static function get(string $key, ?string $default = null): ?string
|
||||
{
|
||||
return static::find($key)?->value ?? $default;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a setting value by key.
|
||||
*/
|
||||
public static function set(string $key, ?string $value): void
|
||||
{
|
||||
static::updateOrCreate(['key' => $key], ['value' => $value]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all settings as a key-value collection.
|
||||
*/
|
||||
public static function allAsCollection(): Collection
|
||||
{
|
||||
return static::pluck('value', 'key');
|
||||
}
|
||||
}
|
||||
27
app/Models/SocialLink.php
Normal file
27
app/Models/SocialLink.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Database\Factories\SocialLinkFactory;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class SocialLink extends Model
|
||||
{
|
||||
/** @use HasFactory<SocialLinkFactory> */
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'platform',
|
||||
'url',
|
||||
'icon',
|
||||
'sort_order',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'sort_order' => 'integer',
|
||||
];
|
||||
}
|
||||
}
|
||||
29
app/Models/TimelineEntry.php
Normal file
29
app/Models/TimelineEntry.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Database\Factories\TimelineEntryFactory;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class TimelineEntry extends Model
|
||||
{
|
||||
/** @use HasFactory<TimelineEntryFactory> */
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'year',
|
||||
'title',
|
||||
'body',
|
||||
'icon',
|
||||
'sort_order',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'year' => 'integer',
|
||||
'sort_order' => 'integer',
|
||||
];
|
||||
}
|
||||
}
|
||||
59
app/Providers/Filament/AdminPanelProvider.php
Normal file
59
app/Providers/Filament/AdminPanelProvider.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?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\Dashboard;
|
||||
use Filament\Panel;
|
||||
use Filament\PanelProvider;
|
||||
use Filament\Support\Colors\Color;
|
||||
use Filament\Widgets\AccountWidget;
|
||||
use Filament\Widgets\FilamentInfoWidget;
|
||||
use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse;
|
||||
use Illuminate\Cookie\Middleware\EncryptCookies;
|
||||
use Illuminate\Foundation\Http\Middleware\PreventRequestForgery;
|
||||
use Illuminate\Routing\Middleware\SubstituteBindings;
|
||||
use Illuminate\Session\Middleware\StartSession;
|
||||
use Illuminate\View\Middleware\ShareErrorsFromSession;
|
||||
|
||||
class AdminPanelProvider extends PanelProvider
|
||||
{
|
||||
public function panel(Panel $panel): Panel
|
||||
{
|
||||
return $panel
|
||||
->default()
|
||||
->id('admin')
|
||||
->path('admin')
|
||||
->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([
|
||||
Dashboard::class,
|
||||
])
|
||||
->discoverWidgets(in: app_path('Filament/Widgets'), for: 'App\Filament\Widgets')
|
||||
->widgets([
|
||||
AccountWidget::class,
|
||||
FilamentInfoWidget::class,
|
||||
])
|
||||
->middleware([
|
||||
EncryptCookies::class,
|
||||
AddQueuedCookiesToResponse::class,
|
||||
StartSession::class,
|
||||
AuthenticateSession::class,
|
||||
ShareErrorsFromSession::class,
|
||||
PreventRequestForgery::class,
|
||||
SubstituteBindings::class,
|
||||
DisableBladeIconComponents::class,
|
||||
DispatchServingFilamentEvent::class,
|
||||
])
|
||||
->authMiddleware([
|
||||
Authenticate::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user