feat: add Music Productions module with CRUD resources and frontend views
This commit is contained in:
@@ -0,0 +1,142 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Admin\Resources\MusicProductions\Schemas;
|
||||
|
||||
use App\Filament\Admin\Resources\Components\TranslationTabs;
|
||||
use Filament\Forms\Components\Checkbox;
|
||||
use Filament\Forms\Components\DatePicker;
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Forms\Components\RichEditor;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Components\Section;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class MusicProductionForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->columns(3)
|
||||
->schema([
|
||||
// Sol Kolon - Ana İçerik (2 sütun genişliğinde)
|
||||
Section::make(__('music_productions.content_section'))
|
||||
->schema([
|
||||
TextInput::make('title')
|
||||
->label(__('music_productions.title_field'))
|
||||
->required()
|
||||
->maxLength(255)
|
||||
->live(onBlur: true)
|
||||
->afterStateUpdated(function (string $operation, $state, callable $set) {
|
||||
if ($operation !== 'create') {
|
||||
return;
|
||||
}
|
||||
$set('slug', \Str::slug($state));
|
||||
}),
|
||||
|
||||
TextInput::make('slug')
|
||||
->label(__('music_productions.slug_field'))
|
||||
->required()
|
||||
->maxLength(255)
|
||||
->unique(ignoreRecord: true)
|
||||
->rules(['alpha_dash'])
|
||||
->helperText(__('music_productions.slug_helper')),
|
||||
|
||||
TextInput::make('client_name')
|
||||
->label(__('music_productions.client_name_field'))
|
||||
->maxLength(255),
|
||||
|
||||
RichEditor::make('content')
|
||||
->label(__('music_productions.content_field'))
|
||||
->fileAttachmentsDisk('public')
|
||||
->fileAttachmentsDirectory('music-productions')
|
||||
->fileAttachmentsVisibility('public')
|
||||
->columnSpanFull(),
|
||||
])
|
||||
->columnSpan(2)
|
||||
->collapsible(false),
|
||||
|
||||
// Sağ Kolon - Ayarlar (1 sütun genişliğinde)
|
||||
Section::make(__('music_productions.settings_section'))
|
||||
->schema([
|
||||
FileUpload::make('cover_image')
|
||||
->label(__('music_productions.cover_image_field'))
|
||||
->image()
|
||||
->disk('public')
|
||||
->directory('music-productions/covers')
|
||||
->visibility('public')
|
||||
->imageEditor()
|
||||
->imageEditorAspectRatios([
|
||||
'16:9',
|
||||
'4:3',
|
||||
'1:1',
|
||||
])
|
||||
->helperText(__('music_productions.cover_image_helper'))
|
||||
->columnSpanFull(),
|
||||
|
||||
DatePicker::make('production_date')
|
||||
->label(__('music_productions.production_date_field'))
|
||||
->displayFormat('d.m.Y')
|
||||
->helperText(__('music_productions.production_date_helper'))
|
||||
->columnSpanFull(),
|
||||
|
||||
TextInput::make('sort_order')
|
||||
->label(__('music_productions.sort_order_field'))
|
||||
->numeric()
|
||||
->default(0)
|
||||
->columnSpanFull(),
|
||||
|
||||
Checkbox::make('is_active')
|
||||
->label(__('music_productions.is_active_field'))
|
||||
->default(true)
|
||||
->helperText(__('music_productions.is_active_helper'))
|
||||
->columnSpanFull(),
|
||||
])
|
||||
->columnSpan(1)
|
||||
->collapsible(false),
|
||||
|
||||
// Alt Kısım - Galeri Görselleri
|
||||
Section::make(__('music_productions.gallery_field'))
|
||||
->schema([
|
||||
FileUpload::make('gallery')
|
||||
->label(__('music_productions.gallery_field'))
|
||||
->multiple()
|
||||
->image()
|
||||
->disk('public')
|
||||
->directory('music-productions/gallery')
|
||||
->visibility('public')
|
||||
->helperText(__('music_productions.gallery_helper'))
|
||||
->columnSpanFull(),
|
||||
])
|
||||
->columnSpanFull()
|
||||
->collapsible(true)
|
||||
->collapsed(false),
|
||||
|
||||
// Çeviriler Kısımı (Çoklu Dil)
|
||||
Section::make('🌍 ' . __('music_productions.translations_section'))
|
||||
->schema([
|
||||
TranslationTabs::make([
|
||||
'title' => [
|
||||
'type' => 'text',
|
||||
'label' => __('music_productions.title_field'),
|
||||
'required' => false,
|
||||
'maxLength' => 255,
|
||||
],
|
||||
'client_name' => [
|
||||
'type' => 'text',
|
||||
'label' => __('music_productions.client_name_field'),
|
||||
'required' => false,
|
||||
'maxLength' => 255,
|
||||
],
|
||||
'content' => [
|
||||
'type' => 'richtext',
|
||||
'label' => __('music_productions.content_field'),
|
||||
'required' => false,
|
||||
],
|
||||
]),
|
||||
])
|
||||
->columnSpanFull()
|
||||
->collapsible(true)
|
||||
->collapsed(false),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user