Refactor navigation icon declarations in various resources for consistency; enhance Group model with new relationships and fillable properties; update Hotel and Pilgrim models with fillable attributes; improve table configurations across resources.
This commit is contained in:
@@ -24,7 +24,7 @@ class DocumentResource extends Resource
|
|||||||
|
|
||||||
protected static ?int $navigationSort = 4;
|
protected static ?int $navigationSort = 4;
|
||||||
|
|
||||||
public static function getNavigationIcon(): string | BackedEnum | Htmlable | null
|
public static function getNavigationIcon(): string|BackedEnum|Htmlable|null
|
||||||
{
|
{
|
||||||
return 'heroicon-o-document-text';
|
return 'heroicon-o-document-text';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class DocumentsTable
|
|||||||
->searchable(),
|
->searchable(),
|
||||||
TextColumn::make('file')
|
TextColumn::make('file')
|
||||||
->searchable(),
|
->searchable(),
|
||||||
|
|
||||||
TextColumn::make('created_at')
|
TextColumn::make('created_at')
|
||||||
->dateTime()
|
->dateTime()
|
||||||
->sortable()
|
->sortable()
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ use App\Filament\Resources\Groups\Pages\CreateGroup;
|
|||||||
use App\Filament\Resources\Groups\Pages\EditGroup;
|
use App\Filament\Resources\Groups\Pages\EditGroup;
|
||||||
use App\Filament\Resources\Groups\Pages\ListGroups;
|
use App\Filament\Resources\Groups\Pages\ListGroups;
|
||||||
use App\Filament\Resources\Groups\RelationManagers\PilgrimsRelationManager;
|
use App\Filament\Resources\Groups\RelationManagers\PilgrimsRelationManager;
|
||||||
|
use App\Filament\Resources\Groups\RelationManagers\ProgramRelationManager;
|
||||||
use App\Filament\Resources\Groups\Schemas\GroupForm;
|
use App\Filament\Resources\Groups\Schemas\GroupForm;
|
||||||
use App\Filament\Resources\Groups\Tables\GroupsTable;
|
use App\Filament\Resources\Groups\Tables\GroupsTable;
|
||||||
use App\Models\Group;
|
use App\Models\Group;
|
||||||
@@ -26,7 +27,7 @@ class GroupResource extends Resource
|
|||||||
|
|
||||||
protected static ?int $navigationSort = 1;
|
protected static ?int $navigationSort = 1;
|
||||||
|
|
||||||
protected static string | BackedEnum | null $navigationIcon = 'icon-flight-takeoff';
|
protected static string|BackedEnum|null $navigationIcon = 'icon-flight-takeoff';
|
||||||
|
|
||||||
public static function form(Schema $schema): Schema
|
public static function form(Schema $schema): Schema
|
||||||
{
|
{
|
||||||
@@ -42,6 +43,7 @@ class GroupResource extends Resource
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
PilgrimsRelationManager::class,
|
PilgrimsRelationManager::class,
|
||||||
|
ProgramRelationManager::class,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,60 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\Groups\RelationManagers;
|
||||||
|
|
||||||
|
use Filament\Actions\AssociateAction;
|
||||||
|
use Filament\Actions\BulkActionGroup;
|
||||||
|
use Filament\Actions\CreateAction;
|
||||||
|
use Filament\Actions\DeleteAction;
|
||||||
|
use Filament\Actions\DeleteBulkAction;
|
||||||
|
use Filament\Actions\DissociateAction;
|
||||||
|
use Filament\Actions\DissociateBulkAction;
|
||||||
|
use Filament\Actions\EditAction;
|
||||||
|
use Filament\Forms\Components\TextInput;
|
||||||
|
use Filament\Resources\RelationManagers\RelationManager;
|
||||||
|
use Filament\Schemas\Schema;
|
||||||
|
use Filament\Tables\Columns\TextColumn;
|
||||||
|
use Filament\Tables\Table;
|
||||||
|
|
||||||
|
class ProgramRelationManager extends RelationManager
|
||||||
|
{
|
||||||
|
protected static string $relationship = 'program';
|
||||||
|
|
||||||
|
public function form(Schema $schema): Schema
|
||||||
|
{
|
||||||
|
return $schema
|
||||||
|
->components([
|
||||||
|
TextInput::make('title')
|
||||||
|
->required()
|
||||||
|
->maxLength(255),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function table(Table $table): Table
|
||||||
|
{
|
||||||
|
return $table
|
||||||
|
->recordTitleAttribute('title')
|
||||||
|
->columns([
|
||||||
|
TextColumn::make('title')
|
||||||
|
->searchable(),
|
||||||
|
])
|
||||||
|
->filters([
|
||||||
|
//
|
||||||
|
])
|
||||||
|
->headerActions([
|
||||||
|
CreateAction::make(),
|
||||||
|
AssociateAction::make(),
|
||||||
|
])
|
||||||
|
->recordActions([
|
||||||
|
EditAction::make(),
|
||||||
|
DissociateAction::make(),
|
||||||
|
DeleteAction::make(),
|
||||||
|
])
|
||||||
|
->toolbarActions([
|
||||||
|
BulkActionGroup::make([
|
||||||
|
DissociateBulkAction::make(),
|
||||||
|
DeleteBulkAction::make(),
|
||||||
|
]),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,12 +17,15 @@ class GroupForm
|
|||||||
->components([
|
->components([
|
||||||
DatePicker::make('start_date')
|
DatePicker::make('start_date')
|
||||||
->label('Başlanýan senesi')
|
->label('Başlanýan senesi')
|
||||||
|
->native(false)
|
||||||
->required()
|
->required()
|
||||||
->live()
|
->live()
|
||||||
->afterStateUpdated(fn(Set $set, ?string $state) => $set('end_date', $state ? Carbon::parse($state)->addDays(14)->format('Y-m-d') : null)),
|
->afterStateUpdated(fn (Set $set, ?string $state) => $set('end_date', $state ? Carbon::parse($state)->addDays(14)->format('Y-m-d') : null))
|
||||||
|
->rules('unique:groups,start_date'),
|
||||||
|
|
||||||
DatePicker::make('end_date')
|
DatePicker::make('end_date')
|
||||||
->label('Gutarýan senesi')
|
->label('Gutarýan senesi')
|
||||||
|
->native(false)
|
||||||
->required(),
|
->required(),
|
||||||
|
|
||||||
Select::make('leader_teacher_id')
|
Select::make('leader_teacher_id')
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
namespace App\Filament\Resources\Groups\Tables;
|
namespace App\Filament\Resources\Groups\Tables;
|
||||||
|
|
||||||
use Filament\Actions\BulkActionGroup;
|
use Filament\Actions\BulkActionGroup;
|
||||||
|
use Filament\Actions\DeleteAction;
|
||||||
use Filament\Actions\DeleteBulkAction;
|
use Filament\Actions\DeleteBulkAction;
|
||||||
use Filament\Actions\EditAction;
|
use Filament\Actions\EditAction;
|
||||||
use Filament\Tables\Columns\TextColumn;
|
use Filament\Tables\Columns\TextColumn;
|
||||||
@@ -33,7 +34,7 @@ class GroupsTable
|
|||||||
->dateTime()
|
->dateTime()
|
||||||
->sortable()
|
->sortable()
|
||||||
->toggleable(isToggledHiddenByDefault: true),
|
->toggleable(isToggledHiddenByDefault: true),
|
||||||
|
|
||||||
TextColumn::make('updated_at')
|
TextColumn::make('updated_at')
|
||||||
->dateTime()
|
->dateTime()
|
||||||
->sortable()
|
->sortable()
|
||||||
@@ -43,7 +44,11 @@ class GroupsTable
|
|||||||
//
|
//
|
||||||
])
|
])
|
||||||
->recordActions([
|
->recordActions([
|
||||||
EditAction::make(),
|
EditAction::make()
|
||||||
|
->iconButton(),
|
||||||
|
|
||||||
|
DeleteAction::make()
|
||||||
|
->iconButton(),
|
||||||
])
|
])
|
||||||
->toolbarActions([
|
->toolbarActions([
|
||||||
BulkActionGroup::make([
|
BulkActionGroup::make([
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ namespace App\Filament\Resources\Hotels;
|
|||||||
use App\Filament\Resources\Hotels\Pages\CreateHotel;
|
use App\Filament\Resources\Hotels\Pages\CreateHotel;
|
||||||
use App\Filament\Resources\Hotels\Pages\EditHotel;
|
use App\Filament\Resources\Hotels\Pages\EditHotel;
|
||||||
use App\Filament\Resources\Hotels\Pages\ListHotels;
|
use App\Filament\Resources\Hotels\Pages\ListHotels;
|
||||||
|
use App\Filament\Resources\Hotels\Pages\ViewHotel;
|
||||||
use App\Filament\Resources\Hotels\RelationManagers\RoomsRelationManager;
|
use App\Filament\Resources\Hotels\RelationManagers\RoomsRelationManager;
|
||||||
use App\Filament\Resources\Hotels\Schemas\HotelForm;
|
use App\Filament\Resources\Hotels\Schemas\HotelForm;
|
||||||
use App\Filament\Resources\Hotels\Tables\HotelsTable;
|
use App\Filament\Resources\Hotels\Tables\HotelsTable;
|
||||||
@@ -12,7 +13,6 @@ use App\Models\Hotel;
|
|||||||
use BackedEnum;
|
use BackedEnum;
|
||||||
use Filament\Resources\Resource;
|
use Filament\Resources\Resource;
|
||||||
use Filament\Schemas\Schema;
|
use Filament\Schemas\Schema;
|
||||||
use Filament\Support\Icons\Heroicon;
|
|
||||||
use Filament\Tables\Table;
|
use Filament\Tables\Table;
|
||||||
|
|
||||||
class HotelResource extends Resource
|
class HotelResource extends Resource
|
||||||
@@ -22,13 +22,14 @@ class HotelResource extends Resource
|
|||||||
protected static ?string $navigationLabel = 'Otellar';
|
protected static ?string $navigationLabel = 'Otellar';
|
||||||
|
|
||||||
protected static ?string $pluralLabel = 'Otellar';
|
protected static ?string $pluralLabel = 'Otellar';
|
||||||
|
|
||||||
protected static ?string $modelLabel = 'Otel';
|
protected static ?string $modelLabel = 'Otel';
|
||||||
|
|
||||||
protected static ?string $recordTitleAttribute = 'name';
|
protected static ?string $recordTitleAttribute = 'name';
|
||||||
|
|
||||||
protected static ?int $navigationSort = 5;
|
protected static ?int $navigationSort = 5;
|
||||||
|
|
||||||
protected static string | BackedEnum | null $navigationIcon = 'heroicon-o-building-office';
|
protected static string|BackedEnum|null $navigationIcon = 'heroicon-o-building-office';
|
||||||
|
|
||||||
public static function form(Schema $schema): Schema
|
public static function form(Schema $schema): Schema
|
||||||
{
|
{
|
||||||
@@ -37,7 +38,9 @@ class HotelResource extends Resource
|
|||||||
|
|
||||||
public static function table(Table $table): Table
|
public static function table(Table $table): Table
|
||||||
{
|
{
|
||||||
return $table->columns(HotelsTable::schema());
|
return $table
|
||||||
|
->columns(HotelsTable::schema())
|
||||||
|
->actions(HotelsTable::actions());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getRelations(): array
|
public static function getRelations(): array
|
||||||
@@ -52,6 +55,7 @@ class HotelResource extends Resource
|
|||||||
return [
|
return [
|
||||||
'index' => ListHotels::route('/'),
|
'index' => ListHotels::route('/'),
|
||||||
'create' => CreateHotel::route('/create'),
|
'create' => CreateHotel::route('/create'),
|
||||||
|
'view' => ViewHotel::route('/{record}'),
|
||||||
'edit' => EditHotel::route('/{record}/edit'),
|
'edit' => EditHotel::route('/{record}/edit'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
26
app/Filament/Resources/Hotels/Pages/ViewHotel.php
Normal file
26
app/Filament/Resources/Hotels/Pages/ViewHotel.php
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\Hotels\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\Hotels\HotelResource;
|
||||||
|
use App\Filament\Resources\Hotels\Schemas\HotelInfolist;
|
||||||
|
use Filament\Actions;
|
||||||
|
use Filament\Resources\Pages\ViewRecord;
|
||||||
|
use Filament\Schemas\Schema;
|
||||||
|
|
||||||
|
class ViewHotel extends ViewRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = HotelResource::class;
|
||||||
|
|
||||||
|
public function infolist(Schema $schema): Schema
|
||||||
|
{
|
||||||
|
return HotelInfolist::configure($schema);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Actions\EditAction::make(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,7 +11,7 @@ class HotelForm
|
|||||||
return [
|
return [
|
||||||
Forms\Components\TextInput::make('name')
|
Forms\Components\TextInput::make('name')
|
||||||
->required(),
|
->required(),
|
||||||
|
|
||||||
Forms\Components\Select::make('city')
|
Forms\Components\Select::make('city')
|
||||||
->options([
|
->options([
|
||||||
'Makkah' => 'Makkah',
|
'Makkah' => 'Makkah',
|
||||||
|
|||||||
24
app/Filament/Resources/Hotels/Schemas/HotelInfolist.php
Normal file
24
app/Filament/Resources/Hotels/Schemas/HotelInfolist.php
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\Hotels\Schemas;
|
||||||
|
|
||||||
|
use Filament\Infolists;
|
||||||
|
use Filament\Schemas\Schema;
|
||||||
|
|
||||||
|
class HotelInfolist
|
||||||
|
{
|
||||||
|
public static function configure(Schema $schema): Schema
|
||||||
|
{
|
||||||
|
return $schema->components([
|
||||||
|
Infolists\Components\TextEntry::make('name'),
|
||||||
|
Infolists\Components\TextEntry::make('city'),
|
||||||
|
Infolists\Components\ImageEntry::make('image')
|
||||||
|
->columnSpanFull(),
|
||||||
|
Infolists\Components\ImageEntry::make('images')
|
||||||
|
->columnSpanFull(),
|
||||||
|
Infolists\Components\TextEntry::make('geo_location'),
|
||||||
|
Infolists\Components\TextEntry::make('haram_distance'),
|
||||||
|
Infolists\Components\TextEntry::make('star'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Filament\Resources\Hotels\Tables;
|
namespace App\Filament\Resources\Hotels\Tables;
|
||||||
|
|
||||||
|
use Filament\Actions\EditAction;
|
||||||
|
use Filament\Actions\ViewAction;
|
||||||
use Filament\Tables;
|
use Filament\Tables;
|
||||||
|
|
||||||
class HotelsTable
|
class HotelsTable
|
||||||
@@ -35,4 +37,12 @@ class HotelsTable
|
|||||||
->toggleable(isToggledHiddenByDefault: true),
|
->toggleable(isToggledHiddenByDefault: true),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function actions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
ViewAction::make(),
|
||||||
|
EditAction::make(),
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,8 +12,6 @@ use App\Models\Pilgrim;
|
|||||||
use BackedEnum;
|
use BackedEnum;
|
||||||
use Filament\Resources\Resource;
|
use Filament\Resources\Resource;
|
||||||
use Filament\Schemas\Schema;
|
use Filament\Schemas\Schema;
|
||||||
use Filament\Support\Icons\Heroicon;
|
|
||||||
use Illuminate\Contracts\Support\Htmlable;
|
|
||||||
use Filament\Tables\Table;
|
use Filament\Tables\Table;
|
||||||
|
|
||||||
class PilgrimResource extends Resource
|
class PilgrimResource extends Resource
|
||||||
@@ -21,10 +19,13 @@ class PilgrimResource extends Resource
|
|||||||
protected static ?string $model = Pilgrim::class;
|
protected static ?string $model = Pilgrim::class;
|
||||||
|
|
||||||
protected static ?int $navigationSort = 2;
|
protected static ?int $navigationSort = 2;
|
||||||
|
|
||||||
protected static ?string $navigationLabel = 'Zyýaratçylar';
|
protected static ?string $navigationLabel = 'Zyýaratçylar';
|
||||||
protected static string | BackedEnum | null $navigationIcon = 'icon-pilgrim-man';
|
|
||||||
|
protected static string|BackedEnum|null $navigationIcon = 'icon-pilgrim-man';
|
||||||
|
|
||||||
protected static ?string $modelLabel = 'Zyýaratçy';
|
protected static ?string $modelLabel = 'Zyýaratçy';
|
||||||
|
|
||||||
protected static ?string $pluralLabel = 'Zyýaratçylar';
|
protected static ?string $pluralLabel = 'Zyýaratçylar';
|
||||||
|
|
||||||
public static function form(Schema $schema): Schema
|
public static function form(Schema $schema): Schema
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ class PilgrimsTable
|
|||||||
|
|
||||||
TextColumn::make('international_passport')
|
TextColumn::make('international_passport')
|
||||||
->searchable(),
|
->searchable(),
|
||||||
|
|
||||||
TextColumn::make('created_at')
|
TextColumn::make('created_at')
|
||||||
->dateTime()
|
->dateTime()
|
||||||
->sortable()
|
->sortable()
|
||||||
|
|||||||
11
app/Filament/Resources/Programs/Pages/CreateProgram.php
Normal file
11
app/Filament/Resources/Programs/Pages/CreateProgram.php
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\Programs\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\Programs\ProgramResource;
|
||||||
|
use Filament\Resources\Pages\CreateRecord;
|
||||||
|
|
||||||
|
class CreateProgram extends CreateRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = ProgramResource::class;
|
||||||
|
}
|
||||||
21
app/Filament/Resources/Programs/Pages/EditProgram.php
Normal file
21
app/Filament/Resources/Programs/Pages/EditProgram.php
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\Programs\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\Programs\ProgramResource;
|
||||||
|
use Filament\Actions\DeleteAction;
|
||||||
|
use Filament\Actions\ViewAction;
|
||||||
|
use Filament\Resources\Pages\EditRecord;
|
||||||
|
|
||||||
|
class EditProgram extends EditRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = ProgramResource::class;
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
ViewAction::make(),
|
||||||
|
DeleteAction::make(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
19
app/Filament/Resources/Programs/Pages/ListPrograms.php
Normal file
19
app/Filament/Resources/Programs/Pages/ListPrograms.php
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\Programs\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\Programs\ProgramResource;
|
||||||
|
use Filament\Actions\CreateAction;
|
||||||
|
use Filament\Resources\Pages\ListRecords;
|
||||||
|
|
||||||
|
class ListPrograms extends ListRecords
|
||||||
|
{
|
||||||
|
protected static string $resource = ProgramResource::class;
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
CreateAction::make(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
19
app/Filament/Resources/Programs/Pages/ViewProgram.php
Normal file
19
app/Filament/Resources/Programs/Pages/ViewProgram.php
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\Programs\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\Programs\ProgramResource;
|
||||||
|
use Filament\Actions\EditAction;
|
||||||
|
use Filament\Resources\Pages\ViewRecord;
|
||||||
|
|
||||||
|
class ViewProgram extends ViewRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = ProgramResource::class;
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
EditAction::make(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
46
app/Filament/Resources/Programs/ProgramResource.php
Normal file
46
app/Filament/Resources/Programs/ProgramResource.php
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\Programs;
|
||||||
|
|
||||||
|
use App\Filament\Resources\Programs\Schemas\ProgramForm;
|
||||||
|
use App\Filament\Resources\Programs\Tables\ProgramsTable;
|
||||||
|
use App\Models\Program;
|
||||||
|
use BackedEnum;
|
||||||
|
use Filament\Resources\Resource;
|
||||||
|
use Filament\Schemas\Schema;
|
||||||
|
use Filament\Tables\Table;
|
||||||
|
|
||||||
|
class ProgramResource extends Resource
|
||||||
|
{
|
||||||
|
protected static ?string $model = Program::class;
|
||||||
|
|
||||||
|
protected static ?string $navigationLabel = 'Programmalar';
|
||||||
|
|
||||||
|
protected static ?string $pluralLabel = 'Programmalar';
|
||||||
|
|
||||||
|
protected static ?string $recordTitleAttribute = 'name';
|
||||||
|
|
||||||
|
protected static ?int $navigationSort = 7;
|
||||||
|
|
||||||
|
protected static string|BackedEnum|null $navigationIcon = 'heroicon-o-calendar-days';
|
||||||
|
|
||||||
|
public static function form(Schema $schema): Schema
|
||||||
|
{
|
||||||
|
return ProgramForm::configure($schema);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function table(Table $table): Table
|
||||||
|
{
|
||||||
|
return ProgramsTable::configure($table);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getPages(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'index' => Pages\ListPrograms::route('/'),
|
||||||
|
'create' => Pages\CreateProgram::route('/create'),
|
||||||
|
'edit' => Pages\EditProgram::route('/{record}/edit'),
|
||||||
|
'view' => Pages\ViewProgram::route('/{record}'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
51
app/Filament/Resources/Programs/Schemas/ProgramForm.php
Normal file
51
app/Filament/Resources/Programs/Schemas/ProgramForm.php
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\Programs\Schemas;
|
||||||
|
|
||||||
|
use Filament\Forms\Components\Repeater;
|
||||||
|
use Filament\Forms\Components\Select;
|
||||||
|
use Filament\Forms\Components\Textarea;
|
||||||
|
use Filament\Forms\Components\TextInput;
|
||||||
|
use Filament\Forms\Components\TimePicker;
|
||||||
|
use Filament\Schemas\Schema;
|
||||||
|
|
||||||
|
class ProgramForm
|
||||||
|
{
|
||||||
|
public static function configure(Schema $schema): Schema
|
||||||
|
{
|
||||||
|
return $schema
|
||||||
|
->components([
|
||||||
|
Select::make('group_id')
|
||||||
|
->relationship('group', 'name')
|
||||||
|
->label('Topar')
|
||||||
|
->required(),
|
||||||
|
Repeater::make('days')
|
||||||
|
->label('Günler')
|
||||||
|
->itemLabel(fn (array $state): ?string => ($state['day_number'] ?? '').'-nji gün')
|
||||||
|
->schema([
|
||||||
|
TextInput::make('day_number')
|
||||||
|
->numeric()
|
||||||
|
->required()
|
||||||
|
->label('Günüň belgisi'),
|
||||||
|
Repeater::make('actions')
|
||||||
|
->label('Actionlar')
|
||||||
|
->schema([
|
||||||
|
TextInput::make('title')
|
||||||
|
->label('Ady')
|
||||||
|
->required()
|
||||||
|
->maxLength(255),
|
||||||
|
Textarea::make('description')
|
||||||
|
->label('Düşündirişi')
|
||||||
|
->columnSpanFull(),
|
||||||
|
TimePicker::make('time')
|
||||||
|
->label('Wagty'),
|
||||||
|
TextInput::make('icon')
|
||||||
|
->label('Ikony')
|
||||||
|
->required()
|
||||||
|
->maxLength(255),
|
||||||
|
])
|
||||||
|
->columns(2),
|
||||||
|
])->columnSpanFull(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
21
app/Filament/Resources/Programs/Schemas/ProgramInfolist.php
Normal file
21
app/Filament/Resources/Programs/Schemas/ProgramInfolist.php
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\Programs\Schemas;
|
||||||
|
|
||||||
|
use Filament\Infolists\Components\TextEntry;
|
||||||
|
use Filament\Schemas\Schema;
|
||||||
|
|
||||||
|
class ProgramInfolist
|
||||||
|
{
|
||||||
|
public static function configure(Schema $schema): Schema
|
||||||
|
{
|
||||||
|
return $schema
|
||||||
|
->components([
|
||||||
|
TextEntry::make('group.id'),
|
||||||
|
TextEntry::make('created_at')
|
||||||
|
->dateTime(),
|
||||||
|
TextEntry::make('updated_at')
|
||||||
|
->dateTime(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
47
app/Filament/Resources/Programs/Tables/ProgramsTable.php
Normal file
47
app/Filament/Resources/Programs/Tables/ProgramsTable.php
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\Programs\Tables;
|
||||||
|
|
||||||
|
use Filament\Tables\Actions\BulkActionGroup;
|
||||||
|
use Filament\Tables\Actions\DeleteBulkAction;
|
||||||
|
use Filament\Tables\Actions\EditAction;
|
||||||
|
use Filament\Tables\Actions\ViewAction;
|
||||||
|
use Filament\Tables\Columns\TextColumn;
|
||||||
|
use Filament\Tables\Table;
|
||||||
|
|
||||||
|
class ProgramsTable
|
||||||
|
{
|
||||||
|
public static function configure(Table $table): Table
|
||||||
|
{
|
||||||
|
return $table
|
||||||
|
->columns([
|
||||||
|
TextColumn::make('group.name')
|
||||||
|
->label('Topar')
|
||||||
|
->searchable()
|
||||||
|
->sortable(),
|
||||||
|
TextColumn::make('days')
|
||||||
|
->label('Gün sany')
|
||||||
|
->getStateUsing(fn ($record) => count($record->days).' gün')
|
||||||
|
->sortable(),
|
||||||
|
TextColumn::make('created_at')
|
||||||
|
->label('Döredilen wagty')
|
||||||
|
->dateTime()
|
||||||
|
->sortable()
|
||||||
|
->toggleable(isToggledHiddenByDefault: true),
|
||||||
|
TextColumn::make('updated_at')
|
||||||
|
->label('Üýtgedilen wagty')
|
||||||
|
->dateTime()
|
||||||
|
->sortable()
|
||||||
|
->toggleable(isToggledHiddenByDefault: true),
|
||||||
|
])
|
||||||
|
->actions([
|
||||||
|
ViewAction::make(),
|
||||||
|
EditAction::make(),
|
||||||
|
])
|
||||||
|
->bulkActions([
|
||||||
|
BulkActionGroup::make([
|
||||||
|
DeleteBulkAction::make(),
|
||||||
|
]),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,7 +11,6 @@ use App\Models\Room;
|
|||||||
use BackedEnum;
|
use BackedEnum;
|
||||||
use Filament\Resources\Resource;
|
use Filament\Resources\Resource;
|
||||||
use Filament\Schemas\Schema;
|
use Filament\Schemas\Schema;
|
||||||
use Filament\Support\Icons\Heroicon;
|
|
||||||
use Filament\Tables\Table;
|
use Filament\Tables\Table;
|
||||||
|
|
||||||
class RoomResource extends Resource
|
class RoomResource extends Resource
|
||||||
@@ -21,13 +20,14 @@ class RoomResource extends Resource
|
|||||||
protected static ?string $navigationLabel = 'Otaglar';
|
protected static ?string $navigationLabel = 'Otaglar';
|
||||||
|
|
||||||
protected static ?string $pluralLabel = 'Otaglar';
|
protected static ?string $pluralLabel = 'Otaglar';
|
||||||
|
|
||||||
protected static ?string $modelLabel = 'Otag';
|
protected static ?string $modelLabel = 'Otag';
|
||||||
|
|
||||||
protected static ?string $recordTitleAttribute = 'name';
|
protected static ?string $recordTitleAttribute = 'name';
|
||||||
|
|
||||||
protected static ?int $navigationSort = 6;
|
protected static ?int $navigationSort = 6;
|
||||||
protected static string | BackedEnum | null $navigationIcon = 'icon-door-open';
|
|
||||||
|
|
||||||
|
protected static string|BackedEnum|null $navigationIcon = 'icon-door-open';
|
||||||
|
|
||||||
public static function form(Schema $schema): Schema
|
public static function form(Schema $schema): Schema
|
||||||
{
|
{
|
||||||
@@ -36,7 +36,8 @@ class RoomResource extends Resource
|
|||||||
|
|
||||||
public static function table(Table $table): Table
|
public static function table(Table $table): Table
|
||||||
{
|
{
|
||||||
return $table->columns(RoomsTable::schema());
|
return $table
|
||||||
|
->columns(RoomsTable::schema());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getRelations(): array
|
public static function getRelations(): array
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class RoomForm
|
|||||||
->required()
|
->required()
|
||||||
->numeric()
|
->numeric()
|
||||||
->default(1),
|
->default(1),
|
||||||
|
|
||||||
Forms\Components\Checkbox::make('wide')
|
Forms\Components\Checkbox::make('wide')
|
||||||
->default(false)
|
->default(false)
|
||||||
->required(),
|
->required(),
|
||||||
|
|||||||
@@ -9,17 +9,22 @@ class RoomsTable
|
|||||||
public static function schema(): array
|
public static function schema(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
Tables\Columns\TextColumn::make('hotel.name')
|
|
||||||
->sortable(),
|
|
||||||
Tables\Columns\TextColumn::make('name')
|
Tables\Columns\TextColumn::make('name')
|
||||||
->searchable(),
|
->searchable(),
|
||||||
|
|
||||||
|
Tables\Columns\TextColumn::make('hotel.name')
|
||||||
|
->sortable(),
|
||||||
|
|
||||||
Tables\Columns\TextColumn::make('floor')
|
Tables\Columns\TextColumn::make('floor')
|
||||||
->searchable(),
|
->searchable(),
|
||||||
|
|
||||||
Tables\Columns\TextColumn::make('bed_count')
|
Tables\Columns\TextColumn::make('bed_count')
|
||||||
->numeric()
|
->numeric()
|
||||||
->sortable(),
|
->sortable(),
|
||||||
|
|
||||||
Tables\Columns\IconColumn::make('wide')
|
Tables\Columns\IconColumn::make('wide')
|
||||||
->boolean(),
|
->boolean(),
|
||||||
|
|
||||||
Tables\Columns\TextColumn::make('created_at')
|
Tables\Columns\TextColumn::make('created_at')
|
||||||
->dateTime()
|
->dateTime()
|
||||||
->sortable()
|
->sortable()
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ use Filament\Actions\BulkActionGroup;
|
|||||||
use Filament\Actions\DeleteBulkAction;
|
use Filament\Actions\DeleteBulkAction;
|
||||||
use Filament\Actions\EditAction as ActionsEditAction;
|
use Filament\Actions\EditAction as ActionsEditAction;
|
||||||
use Filament\Forms;
|
use Filament\Forms;
|
||||||
use Filament\Schemas\Schema;
|
|
||||||
use Filament\Resources\Resource;
|
use Filament\Resources\Resource;
|
||||||
|
use Filament\Schemas\Schema;
|
||||||
use Filament\Tables;
|
use Filament\Tables;
|
||||||
use Filament\Tables\Table;
|
use Filament\Tables\Table;
|
||||||
use Illuminate\Contracts\Support\Htmlable;
|
use Illuminate\Contracts\Support\Htmlable;
|
||||||
@@ -29,7 +29,7 @@ class TeacherResource extends Resource
|
|||||||
|
|
||||||
protected static ?int $navigationSort = 3;
|
protected static ?int $navigationSort = 3;
|
||||||
|
|
||||||
public static function getNavigationIcon(): string | BackedEnum | Htmlable | null
|
public static function getNavigationIcon(): string|BackedEnum|Htmlable|null
|
||||||
{
|
{
|
||||||
return 'heroicon-o-user-group';
|
return 'heroicon-o-user-group';
|
||||||
}
|
}
|
||||||
|
|||||||
22
app/Http/Controllers/CurrencyRatesController.php
Normal file
22
app/Http/Controllers/CurrencyRatesController.php
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Currency rates controller
|
||||||
|
*/
|
||||||
|
class CurrencyRatesController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* USD to sar
|
||||||
|
*/
|
||||||
|
public function index(): JsonResponse
|
||||||
|
{
|
||||||
|
return response()->json([
|
||||||
|
'USD_TO_SAR' => '3.70',
|
||||||
|
'USD_TO_TMT' => '19.5',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
11
app/Http/Controllers/TestController.php
Normal file
11
app/Http/Controllers/TestController.php
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
class TestController extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
return 'Plain test';
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,11 +3,12 @@
|
|||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property date $start_date
|
* @property date $start_date
|
||||||
@@ -20,7 +21,12 @@ class Group extends Model
|
|||||||
{
|
{
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
|
|
||||||
/**
|
protected $fillable = [
|
||||||
|
'name',
|
||||||
|
'leader_teacher_id',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
* @var array<string, string>
|
* @var array<string, string>
|
||||||
*/
|
*/
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
@@ -28,23 +34,17 @@ class Group extends Model
|
|||||||
'end_date' => 'date',
|
'end_date' => 'date',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the name of the group
|
* Get the name of the group
|
||||||
*
|
*
|
||||||
* @return Attribute
|
* */
|
||||||
* */
|
|
||||||
public function name(): Attribute
|
public function name(): Attribute
|
||||||
{
|
{
|
||||||
return Attribute::make(
|
return Attribute::make(
|
||||||
get: fn ($value) => $this->start_date->format('d M') . ' - ' . $this->end_date->format('d M'),
|
get: fn ($value) => $this->start_date->format('d M').' - '.$this->end_date->format('d M'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function pilgrims(): HasMany
|
|
||||||
{
|
|
||||||
return $this->hasMany(Pilgrim::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function leaderTeacher(): BelongsTo
|
public function leaderTeacher(): BelongsTo
|
||||||
{
|
{
|
||||||
return $this->belongsTo(Teacher::class, 'leader_teacher_id');
|
return $this->belongsTo(Teacher::class, 'leader_teacher_id');
|
||||||
@@ -54,4 +54,19 @@ class Group extends Model
|
|||||||
{
|
{
|
||||||
return $this->belongsToMany(Teacher::class, 'group_teacher');
|
return $this->belongsToMany(Teacher::class, 'group_teacher');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function teachers(): BelongsToMany
|
||||||
|
{
|
||||||
|
return $this->belongsToMany(Teacher::class, 'group_teacher');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function pilgrims(): HasMany
|
||||||
|
{
|
||||||
|
return $this->hasMany(Pilgrim::class, 'group_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function program(): HasOne
|
||||||
|
{
|
||||||
|
return $this->hasOne(Program::class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,12 +9,12 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
|
|||||||
class Hotel extends Model
|
class Hotel extends Model
|
||||||
{
|
{
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array<string, string>
|
* @return array<string, string>
|
||||||
*/
|
*/
|
||||||
protected function casts(): array
|
protected function casts(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'images' => 'array',
|
'images' => 'array',
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -23,6 +23,16 @@ class Pilgrim extends Model
|
|||||||
{
|
{
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'group_id',
|
||||||
|
'first_name',
|
||||||
|
'last_name',
|
||||||
|
'birthdate',
|
||||||
|
'image',
|
||||||
|
'local_passport',
|
||||||
|
'international_passport',
|
||||||
|
];
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'birthdate' => 'date',
|
'birthdate' => 'date',
|
||||||
];
|
];
|
||||||
|
|||||||
30
app/Models/Program.php
Normal file
30
app/Models/Program.php
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
|
||||||
|
class Program extends Model
|
||||||
|
{
|
||||||
|
/** @use HasFactory<\Database\Factories\ProgramFactory> */
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'group_id',
|
||||||
|
'days',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected function casts(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'days' => 'array',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function group(): BelongsTo
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Group::class);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,7 +11,6 @@ use Filament\Panel;
|
|||||||
use Filament\PanelProvider;
|
use Filament\PanelProvider;
|
||||||
use Filament\Support\Colors\Color;
|
use Filament\Support\Colors\Color;
|
||||||
use Filament\Widgets\AccountWidget;
|
use Filament\Widgets\AccountWidget;
|
||||||
use Filament\Widgets\FilamentInfoWidget;
|
|
||||||
use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse;
|
use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse;
|
||||||
use Illuminate\Cookie\Middleware\EncryptCookies;
|
use Illuminate\Cookie\Middleware\EncryptCookies;
|
||||||
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken;
|
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken;
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ use Illuminate\Foundation\Configuration\Middleware;
|
|||||||
return Application::configure(basePath: dirname(__DIR__))
|
return Application::configure(basePath: dirname(__DIR__))
|
||||||
->withRouting(
|
->withRouting(
|
||||||
web: __DIR__.'/../routes/web.php',
|
web: __DIR__.'/../routes/web.php',
|
||||||
|
api: __DIR__.'/../routes/api.php',
|
||||||
commands: __DIR__.'/../routes/console.php',
|
commands: __DIR__.'/../routes/console.php',
|
||||||
health: '/up',
|
health: '/up',
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ return [
|
|||||||
'sets' => [
|
'sets' => [
|
||||||
|
|
||||||
'default' => [
|
'default' => [
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|-----------------------------------------------------------------
|
|-----------------------------------------------------------------
|
||||||
| Icons Path
|
| Icons Path
|
||||||
@@ -29,9 +29,9 @@ return [
|
|||||||
| Relative to the disk root when the disk option is set.
|
| Relative to the disk root when the disk option is set.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'path' => 'resources/svg',
|
'path' => 'resources/svg',
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|-----------------------------------------------------------------
|
|-----------------------------------------------------------------
|
||||||
| Filesystem Disk
|
| Filesystem Disk
|
||||||
@@ -42,9 +42,9 @@ return [
|
|||||||
| starts relatively from the disk root.
|
| starts relatively from the disk root.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'disk' => '',
|
'disk' => '',
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|-----------------------------------------------------------------
|
|-----------------------------------------------------------------
|
||||||
| Default Prefix
|
| Default Prefix
|
||||||
@@ -55,9 +55,9 @@ return [
|
|||||||
| to every icon name. It's required and needs to be unique.
|
| to every icon name. It's required and needs to be unique.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'prefix' => 'icon',
|
'prefix' => 'icon',
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|-----------------------------------------------------------------
|
|-----------------------------------------------------------------
|
||||||
| Fallback Icon
|
| Fallback Icon
|
||||||
@@ -67,9 +67,9 @@ return [
|
|||||||
| icon when an icon in this set cannot be found.
|
| icon when an icon in this set cannot be found.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'fallback' => '',
|
'fallback' => '',
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|-----------------------------------------------------------------
|
|-----------------------------------------------------------------
|
||||||
| Default Set Classes
|
| Default Set Classes
|
||||||
@@ -79,9 +79,9 @@ return [
|
|||||||
| will be applied by default to all icons within this set.
|
| will be applied by default to all icons within this set.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'class' => '',
|
'class' => '',
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|-----------------------------------------------------------------
|
|-----------------------------------------------------------------
|
||||||
| Default Set Attributes
|
| Default Set Attributes
|
||||||
@@ -91,12 +91,12 @@ return [
|
|||||||
| will be applied by default to all icons within this set.
|
| will be applied by default to all icons within this set.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'attributes' => [
|
'attributes' => [
|
||||||
// 'width' => 50,
|
// 'width' => 50,
|
||||||
// 'height' => 50,
|
// 'height' => 50,
|
||||||
],
|
],
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|||||||
24
database/factories/GroupFactory.php
Normal file
24
database/factories/GroupFactory.php
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Factories;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Group>
|
||||||
|
*/
|
||||||
|
class GroupFactory extends Factory
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Define the model's default state.
|
||||||
|
*
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
public function definition(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'start_date' => $this->faker->dateTimeBetween('+1 week', '+2 week'),
|
||||||
|
'end_date' => $this->faker->dateTimeBetween('+3 week', '+4 week'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
54
database/factories/ProgramFactory.php
Normal file
54
database/factories/ProgramFactory.php
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Factories;
|
||||||
|
|
||||||
|
use App\Models\Group;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Program>
|
||||||
|
*/
|
||||||
|
class ProgramFactory extends Factory
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Define the model's default state.
|
||||||
|
*
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
public function definition(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'group_id' => Group::factory(),
|
||||||
|
'days' => [
|
||||||
|
[
|
||||||
|
'day_number' => 1,
|
||||||
|
'actions' => [
|
||||||
|
[
|
||||||
|
'title' => 'Mekkä şäherine ugramak',
|
||||||
|
'description' => $this->faker->paragraph,
|
||||||
|
'time' => '09:00',
|
||||||
|
'icon' => 'heroicon-o-paper-airplane',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'title' => 'Mekgedäki myhmanhana ýerleşmek',
|
||||||
|
'description' => $this->faker->paragraph,
|
||||||
|
'time' => '14:00',
|
||||||
|
'icon' => 'heroicon-o-building-office-2',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'day_number' => 2,
|
||||||
|
'actions' => [
|
||||||
|
[
|
||||||
|
'title' => 'Umra ybadaty',
|
||||||
|
'description' => $this->faker->paragraph,
|
||||||
|
'time' => '09:00',
|
||||||
|
'icon' => 'heroicon-o-moon',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('programs', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->foreignId('group_id')->constrained()->cascadeOnDelete();
|
||||||
|
$table->json('days');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('programs');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -2,9 +2,8 @@
|
|||||||
|
|
||||||
namespace Database\Seeders;
|
namespace Database\Seeders;
|
||||||
|
|
||||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
|
||||||
use Illuminate\Database\Seeder;
|
|
||||||
use App\Models\Teacher;
|
use App\Models\Teacher;
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
class TeacherTableSeeder extends Seeder
|
class TeacherTableSeeder extends Seeder
|
||||||
{
|
{
|
||||||
|
|||||||
11
routes/api.php
Normal file
11
routes/api.php
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use App\Http\Controllers\CurrencyRatesController;
|
||||||
|
use App\Http\Controllers\TestController;
|
||||||
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
|
Route::get('test', [TestController::class, 'index']);
|
||||||
|
|
||||||
|
Route::prefix('v1')->group(function () {
|
||||||
|
Route::get('currency-rates', [CurrencyRatesController::class, 'index']);
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user