feat: Add Logos page, refactor Testimonials to RelationManager, and improve designs
This commit is contained in:
@@ -71,12 +71,6 @@ class BlogForm
|
||||
->disk('public')
|
||||
->directory('blogs/featured')
|
||||
->visibility('public')
|
||||
->imageEditor()
|
||||
->imageEditorAspectRatios([
|
||||
'16:9',
|
||||
'4:3',
|
||||
'1:1',
|
||||
])
|
||||
->helperText(__('blog.featured_image_helper'))
|
||||
->columnSpanFull(),
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ class PageResource extends Resource
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
RelationManagers\TestimonialsRelationManager::class,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Admin\Resources\Pages\RelationManagers;
|
||||
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
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\Schemas\Schema;
|
||||
use Filament\Resources\RelationManagers\RelationManager;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
|
||||
class TestimonialsRelationManager extends RelationManager
|
||||
{
|
||||
protected static string $relationship = 'testimonials';
|
||||
|
||||
protected static ?string $title = 'Müşteri Görüşleri';
|
||||
|
||||
protected static ?string $modelLabel = 'Müşteri Görüşü';
|
||||
|
||||
protected static ?string $pluralModelLabel = 'Müşteri Görüşleri';
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
|
||||
public static function canViewForRecord(\Illuminate\Database\Eloquent\Model $ownerRecord, string $pageClass): bool
|
||||
{
|
||||
// Sadece Müşteri Görüşleri sayfası veya testimonials şablonu kullananlar için göster
|
||||
return $ownerRecord->slug === 'musteri-gorusleri' ||
|
||||
$ownerRecord->template === 'corporate.testimonials' ||
|
||||
$ownerRecord->is_homepage;
|
||||
}
|
||||
|
||||
public function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->schema([
|
||||
TextInput::make('name')
|
||||
->label('Müşteri Adı')
|
||||
->required()
|
||||
->maxLength(255),
|
||||
TextInput::make('position')
|
||||
->label('Şirket / Ünvan')
|
||||
->maxLength(255),
|
||||
Textarea::make('content')
|
||||
->label('Görüş / Yorum')
|
||||
->required()
|
||||
->columnSpanFull(),
|
||||
Select::make('rating')
|
||||
->label('Puan')
|
||||
->options([
|
||||
1 => '1 Yıldız',
|
||||
2 => '2 Yıldız',
|
||||
3 => '3 Yıldız',
|
||||
4 => '4 Yıldız',
|
||||
5 => '5 Yıldız',
|
||||
])
|
||||
->default(5)
|
||||
->required(),
|
||||
FileUpload::make('avatar')
|
||||
->label('Profil Resmi')
|
||||
->image()
|
||||
->directory('testimonials'),
|
||||
Toggle::make('is_active')
|
||||
->label('Aktif')
|
||||
->default(true),
|
||||
TextInput::make('sort_order')
|
||||
->label('Sıralama')
|
||||
->numeric()
|
||||
->default(0),
|
||||
]);
|
||||
}
|
||||
|
||||
public function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->recordTitleAttribute('name')
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('name')
|
||||
->label('Ad')
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('position')
|
||||
->label('Ünvan')
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('rating')
|
||||
->label('Puan')
|
||||
->sortable(),
|
||||
Tables\Columns\IconColumn::make('is_active')
|
||||
->label('Aktif')
|
||||
->boolean()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('sort_order')
|
||||
->label('Sıra')
|
||||
->sortable(),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->headerActions([
|
||||
CreateAction::make(),
|
||||
])
|
||||
->actions([
|
||||
EditAction::make(),
|
||||
DeleteAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ use App\Filament\Admin\Resources\Pages\Schemas\Sections\SectionBuilderSection;
|
||||
use App\Filament\Admin\Resources\Pages\Schemas\Sections\SectionTemplatesSection;
|
||||
use App\Filament\Admin\Resources\Pages\Schemas\Sections\SeoSection;
|
||||
use App\Filament\Admin\Resources\Pages\Schemas\Sections\TranslationsSection;
|
||||
use App\Filament\Admin\Resources\Pages\Schemas\Sections\LogosSection;
|
||||
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
@@ -49,6 +50,9 @@ class PageForm
|
||||
SectionTemplatesSection::make(),
|
||||
FooterTemplateSection::make(),
|
||||
|
||||
// Full Width - Logos (Only for Logolarımız template)
|
||||
LogosSection::make(),
|
||||
|
||||
// Full Width - Translations
|
||||
TranslationsSection::make(),
|
||||
]);
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Admin\Resources\Pages\Schemas\Sections;
|
||||
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Schemas\Components\Grid;
|
||||
use Filament\Schemas\Components\Section;
|
||||
use Filament\Schemas\Components\Utilities\Get;
|
||||
|
||||
class LogosSection
|
||||
{
|
||||
public static function make(): Section
|
||||
{
|
||||
return Section::make(__('Logolar'))
|
||||
->description(__('Bu sayfada gösterilecek logoları buradan yönetebilirsiniz.'))
|
||||
->schema([
|
||||
Grid::make(3)
|
||||
->schema([
|
||||
FileUpload::make('data.logo_1')
|
||||
->label(__('Logo 1'))
|
||||
->disk('public'),
|
||||
|
||||
FileUpload::make('data.logo_2')
|
||||
->label(__('Logo 2'))
|
||||
->disk('public'),
|
||||
|
||||
FileUpload::make('data.logo_3')
|
||||
->label(__('Logo 3'))
|
||||
->disk('public'),
|
||||
]),
|
||||
])
|
||||
->visible(fn (Get $get): bool => $get('template') === 'corporate.logos')
|
||||
->columnSpanFull()
|
||||
->collapsible();
|
||||
}
|
||||
}
|
||||
@@ -21,12 +21,6 @@ class PageSettingsSection
|
||||
->disk('public')
|
||||
->directory('pages/featured')
|
||||
->visibility('public')
|
||||
->imageEditor()
|
||||
->imageEditorAspectRatios([
|
||||
'16:9',
|
||||
'4:3',
|
||||
'1:1',
|
||||
])
|
||||
->helperText(__('pages.featured_image_helper_text'))
|
||||
->columnSpanFull(),
|
||||
|
||||
@@ -70,6 +64,8 @@ class PageSettingsSection
|
||||
'blog' => __('pages.template_blog'),
|
||||
'contact' => __('pages.template_contact'),
|
||||
'home' => 'Home',
|
||||
'corporate.testimonials' => 'Müşteri Görüşleri (Kurumsal)',
|
||||
'corporate.logos' => 'Logolarımız (Kurumsal)',
|
||||
])
|
||||
->default('default')
|
||||
->columnSpanFull(),
|
||||
|
||||
@@ -233,7 +233,7 @@ class SectionBuilderSection
|
||||
->image()
|
||||
->disk('public')
|
||||
->directory('pages/sections')
|
||||
->imageEditor()
|
||||
->directory('pages/sections')
|
||||
->live()
|
||||
->afterStateUpdated(fn ($state, callable $set) => $set('value', $state))
|
||||
->afterStateHydrated(function ($component, $state, Get $get) {
|
||||
|
||||
Reference in New Issue
Block a user