Refactor Filament resources and models; add attribute casting in Group model, update navigation icons, and remove TeacherSeeder in favor of UserTableSeeder.
This commit is contained in:
@@ -32,9 +32,6 @@ This application is a Laravel application and its main Laravel ecosystems packag
|
||||
- Stick to existing directory structure - don't create new base folders without approval.
|
||||
- Do not change the application's dependencies without approval.
|
||||
|
||||
## Frontend Bundling
|
||||
- If the user doesn't see a frontend change reflected in the UI, it could mean they need to run `npm run build`, `npm run dev`, or `composer run dev`. Ask them.
|
||||
|
||||
## Localization
|
||||
- App should be in Turkmen language.
|
||||
- All the validation messages should be in Turkmen language.
|
||||
@@ -115,6 +112,7 @@ protected function isAccessible(User $user, ?string $path = null): bool
|
||||
|
||||
## PHPDoc Blocks
|
||||
- Add useful array shape type definitions for arrays when appropriate.
|
||||
- Add types and properties for models, controllers, functions, etc.
|
||||
|
||||
## Enums
|
||||
- Typically, keys in an Enum should be TitleCase. For example: `FavoritePerson`, `BestLake`, `Monthly`.
|
||||
|
||||
@@ -14,11 +14,6 @@ class GroupsTable
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('leaderTeacher.name')
|
||||
->label('Topar başy')
|
||||
->searchable()
|
||||
->sortable(),
|
||||
|
||||
TextColumn::make('start_date')
|
||||
->label('Başlanýan senesi')
|
||||
->date()
|
||||
@@ -29,6 +24,11 @@ class GroupsTable
|
||||
->date()
|
||||
->sortable(),
|
||||
|
||||
TextColumn::make('leaderTeacher.name')
|
||||
->label('Topar başy')
|
||||
->searchable()
|
||||
->sortable(),
|
||||
|
||||
TextColumn::make('created_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
|
||||
@@ -13,20 +13,24 @@ use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Illuminate\Contracts\Support\Htmlable;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class PilgrimResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Pilgrim::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedRectangleStack;
|
||||
|
||||
protected static ?string $navigationLabel = 'Zyýaratçylar';
|
||||
|
||||
protected static ?string $pluralLabel = 'Zyýaratçylar';
|
||||
|
||||
protected static ?int $navigationSort = 2;
|
||||
|
||||
public static function getNavigationIcon(): string | BackedEnum | Htmlable | null
|
||||
{
|
||||
return 'icon-pilgrim-man';
|
||||
}
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return PilgrimForm::configure($schema);
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
@@ -19,6 +20,21 @@ class Group extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
/**
|
||||
* @var array<string, string>
|
||||
*/
|
||||
protected $casts = [
|
||||
'start_date' => 'date',
|
||||
'end_date' => 'date',
|
||||
];
|
||||
|
||||
public function name(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: fn ($value) => $this->start_date->format('d M') . ' - ' . $this->end_date->format('d M'),
|
||||
);
|
||||
}
|
||||
|
||||
public function pilgrims(): HasMany
|
||||
{
|
||||
return $this->hasMany(Pilgrim::class);
|
||||
|
||||
@@ -7,6 +7,14 @@ use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property string $name
|
||||
* @property string $photo
|
||||
* @property string $bio
|
||||
* @property Carbon $created_at
|
||||
* @property Carbon $updated_at
|
||||
*/
|
||||
class Teacher extends Model
|
||||
{
|
||||
/** @use HasFactory<\Database\Factories\TeacherFactory> */
|
||||
|
||||
@@ -11,9 +11,9 @@ class DatabaseSeeder extends Seeder
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
// User::factory(10)->create();
|
||||
$this->call([
|
||||
TeacherSeeder::class,
|
||||
UserTableSeeder::class,
|
||||
TeacherTableSeeder::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Teacher;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class TeacherSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
Teacher::factory(10)->create();
|
||||
}
|
||||
}
|
||||
36
database/seeders/TeacherTableSeeder.php
Normal file
36
database/seeders/TeacherTableSeeder.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
use App\Models\Teacher;
|
||||
|
||||
class TeacherTableSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$teachers = collect([
|
||||
[
|
||||
'name' => 'Nurmuhammet',
|
||||
'photo' => 'teachers/nurmuhammet.png',
|
||||
'bio' => 'Nurmuhammet esasy topar ýolbaşçy.',
|
||||
],
|
||||
[
|
||||
'name' => 'Juma',
|
||||
'photo' => 'teachers/jumash.png',
|
||||
'bio' => 'Juma, Abdyrahman tagsyryň okuwçysy, topar ýolbaşçy.',
|
||||
],
|
||||
[
|
||||
'name' => 'Resul',
|
||||
'photo' => 'teachers/resul.png',
|
||||
'bio' => 'Resul topar ýolbaşçy.',
|
||||
],
|
||||
]);
|
||||
|
||||
$teachers->each(fn ($teacher) => Teacher::create($teacher));
|
||||
}
|
||||
}
|
||||
124
resources/svg/pilgrim-man.svg
Normal file
124
resources/svg/pilgrim-man.svg
Normal file
@@ -0,0 +1,124 @@
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
width="100%" viewBox="0 0 176 224" enable-background="new 0 0 176 224" xml:space="preserve" fill="currentColor">
|
||||
<path fill="currentColor" opacity="1.000000" stroke="none"
|
||||
d="
|
||||
M3.437500,225.000000
|
||||
C4.484108,216.396576 3.493110,207.726227 3.633236,199.090134
|
||||
C3.889388,183.303284 9.315187,169.874832 20.923206,159.018982
|
||||
C30.600880,149.968384 42.203785,145.551941 55.250473,144.764221
|
||||
C65.264870,144.159592 72.116486,136.618652 71.580200,126.515846
|
||||
C71.482681,124.678871 70.304977,123.932426 68.989548,123.179993
|
||||
C55.630020,115.538254 47.924362,103.650673 43.629833,89.252815
|
||||
C42.867767,86.697922 41.696678,85.117676 38.995968,84.026909
|
||||
C29.418320,80.158630 27.437551,69.056938 35.107208,62.173729
|
||||
C37.488811,60.036339 37.830772,57.964649 37.396492,55.147873
|
||||
C33.457710,29.600729 48.023594,10.744214 73.886490,7.682098
|
||||
C82.355896,6.679337 90.806374,6.012703 99.240234,7.730997
|
||||
C105.755394,9.058380 111.683762,11.517716 115.612427,17.313150
|
||||
C116.482010,18.595921 117.545525,19.373812 119.116180,19.854017
|
||||
C132.945755,24.082203 137.389236,29.903784 138.174835,44.652061
|
||||
C138.280914,46.643658 138.453323,48.717457 138.041702,50.634380
|
||||
C136.930313,55.810200 137.560150,59.598629 142.014084,63.721432
|
||||
C148.472366,69.699570 145.527100,80.502823 137.200378,83.853477
|
||||
C134.178482,85.069496 132.883972,86.780434 131.968384,89.757172
|
||||
C127.667313,103.740608 120.092720,115.374779 107.105293,122.896301
|
||||
C105.811905,123.645348 104.615044,124.388260 104.329956,126.155708
|
||||
C103.510384,131.236908 108.257050,140.872177 112.902016,143.237244
|
||||
C115.054710,144.333328 117.085838,145.054764 119.301270,143.054321
|
||||
C121.320610,141.230972 124.048767,141.306732 126.465996,141.870087
|
||||
C136.329163,144.168823 145.353394,147.293091 153.628571,154.298645
|
||||
C160.882370,160.439560 166.475388,166.994492 170.562912,175.229111
|
||||
C172.077194,178.279724 173.000519,181.418106 171.224838,184.790771
|
||||
C170.806732,185.584915 170.795715,186.736496 170.948059,187.666199
|
||||
C172.928635,199.752808 171.905807,211.927887 172.044876,224.533081
|
||||
C170.285645,225.000000 168.571289,225.000000 166.321457,224.541412
|
||||
C165.785980,214.189987 165.785980,204.297180 165.785980,194.404358
|
||||
C163.373245,195.447632 162.088577,196.869354 160.796616,198.284378
|
||||
C152.343048,207.543076 142.847168,215.507416 131.887161,221.675842
|
||||
C130.174332,222.639847 128.194778,223.257141 127.000000,225.000000
|
||||
C122.310745,225.000000 117.621490,225.000000 112.604218,224.668884
|
||||
C113.221252,223.008774 114.758766,222.732391 116.138451,222.205414
|
||||
C132.349884,216.013382 145.872452,206.010162 157.095963,192.906540
|
||||
C167.705063,180.520264 167.505600,177.597595 156.845688,165.214249
|
||||
C154.027313,161.940201 152.256668,161.819717 149.715942,165.589218
|
||||
C128.075821,197.695145 97.242943,215.005920 59.626434,221.535675
|
||||
C55.065144,222.327438 49.841362,221.172409 46.000000,225.000000
|
||||
C44.285641,225.000000 42.571285,225.000000 40.407597,224.531708
|
||||
C39.943336,221.399734 39.913357,218.736023 39.916279,216.072342
|
||||
C39.925232,207.914719 39.917706,199.756866 39.985855,191.599670
|
||||
C40.001129,189.771408 40.115730,187.777374 42.268116,187.045135
|
||||
C43.933308,186.478668 45.242424,187.315521 45.991909,188.771240
|
||||
C46.775795,190.293777 47.871815,190.296600 49.324104,190.022247
|
||||
C70.857094,185.954514 90.552017,178.135712 106.061661,161.963043
|
||||
C109.111259,158.783081 112.185432,155.456528 113.394753,151.023514
|
||||
C102.224731,143.655060 102.144531,143.676895 98.659386,130.873398
|
||||
C97.793610,127.692810 96.110878,126.855530 93.192139,127.661133
|
||||
C90.413887,128.427963 87.406601,128.864807 84.793938,128.039429
|
||||
C79.108688,126.243355 77.389870,128.563782 76.183212,133.826630
|
||||
C73.453537,145.732071 66.818108,150.901169 55.206280,151.269318
|
||||
C30.464672,152.053757 10.596730,172.255844 10.244061,197.036728
|
||||
C10.111418,206.357101 10.078423,215.678864 10.000000,225.000000
|
||||
C7.958333,225.000000 5.916667,225.000000 3.437500,225.000000
|
||||
M69.247742,50.255520
|
||||
C61.023701,45.472923 54.805752,47.234280 50.284302,55.583576
|
||||
C48.840424,58.249836 47.704117,61.080563 47.459221,64.051941
|
||||
C45.980171,81.997742 50.409798,98.110168 63.244556,111.201241
|
||||
C75.902168,124.111610 94.233612,125.336899 108.571922,114.377579
|
||||
C119.746147,105.836685 125.239273,93.966774 127.713623,80.443184
|
||||
C129.204178,72.296471 129.518936,64.218666 126.008751,56.469093
|
||||
C121.811646,47.202957 114.200233,45.032612 105.768196,50.597931
|
||||
C93.806412,58.492958 81.853241,58.672161 69.247742,50.255520
|
||||
M142.534744,165.028076
|
||||
C143.178101,164.057755 143.838364,163.098175 144.461929,162.115280
|
||||
C147.659149,157.075714 147.516846,156.552643 142.444275,153.769791
|
||||
C138.037918,151.352417 133.349304,149.729828 128.471603,148.573868
|
||||
C124.787476,147.700745 122.232971,148.410263 120.517342,152.305481
|
||||
C118.090485,157.815521 114.248688,162.449402 110.090874,166.821518
|
||||
C96.181618,181.447708 78.585617,189.206268 59.499065,194.285400
|
||||
C45.941887,197.893082 46.096767,197.941147 46.250679,212.007553
|
||||
C46.297993,216.331558 48.074093,217.247421 51.766685,216.366013
|
||||
C52.735699,216.134720 53.709774,215.900452 54.694893,215.764297
|
||||
C90.581741,210.804276 120.336380,195.163330 142.534744,165.028076
|
||||
M106.012291,43.018753
|
||||
C116.547684,39.296047 124.885757,42.167904 131.412598,52.754456
|
||||
C131.412598,47.645813 131.896408,43.821182 131.318787,40.164204
|
||||
C129.794861,30.516209 125.949387,27.145382 116.180092,26.336283
|
||||
C113.906075,26.147947 112.429298,25.296963 111.552803,23.231539
|
||||
C109.313614,17.954983 104.881096,15.493503 99.624161,14.378000
|
||||
C89.877609,12.309818 80.081818,12.659400 70.426460,14.828440
|
||||
C50.255009,19.359880 41.169453,32.504505 43.857628,54.362904
|
||||
C44.380047,53.123333 44.495193,52.642708 44.755871,52.261631
|
||||
C53.352108,39.694904 61.849018,37.960579 74.728485,46.267147
|
||||
C78.487595,48.691578 82.494141,49.729721 86.940880,50.049759
|
||||
C94.155342,50.568996 99.754013,47.161243 106.012291,43.018753
|
||||
M136.352051,67.198318
|
||||
C134.417801,70.490730 134.991318,74.074196 134.505920,78.102119
|
||||
C139.515808,74.227478 139.880737,72.141907 136.352051,67.198318
|
||||
M36.674431,71.710503
|
||||
C37.008450,73.938522 37.291901,76.199356 40.301109,77.259300
|
||||
C40.832550,73.613556 41.313808,70.391037 39.336750,67.311523
|
||||
C37.348873,68.117058 37.293800,69.721222 36.674431,71.710503
|
||||
z"/>
|
||||
<path fill="#000000" opacity="1.000000" stroke="none"
|
||||
d="
|
||||
M143.961578,197.980057
|
||||
C139.321213,202.355637 134.463196,205.862762 129.346985,209.011276
|
||||
C127.629677,210.068130 125.602921,211.236343 124.168198,208.770264
|
||||
C122.893120,206.578568 124.214279,204.969940 126.071754,203.803345
|
||||
C133.885193,198.896118 140.786667,192.914734 147.028519,186.142410
|
||||
C148.472443,184.575790 150.207855,183.292938 152.184830,185.076279
|
||||
C154.178848,186.874985 153.066711,188.728043 151.593231,190.271179
|
||||
C149.178085,192.800552 146.681946,195.252579 143.961578,197.980057
|
||||
z"/>
|
||||
<path fill="#000000" opacity="1.000000" stroke="none"
|
||||
d="
|
||||
M99.962036,187.912079
|
||||
C102.139534,186.636902 103.969437,185.494278 105.861885,184.466827
|
||||
C107.350327,183.658737 108.823349,183.774689 109.761124,185.320709
|
||||
C110.638191,186.766647 110.450974,188.385193 109.100746,189.353928
|
||||
C101.108208,195.088287 92.489357,199.643585 83.071960,202.573502
|
||||
C81.462364,203.074280 80.071472,202.426758 79.602745,200.655991
|
||||
C79.006973,198.405258 80.319778,197.331009 82.222038,196.575775
|
||||
C88.239449,194.186722 94.082680,191.430099 99.962036,187.912079
|
||||
z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 7.4 KiB |
2
storage/app/private/.gitignore
vendored
2
storage/app/private/.gitignore
vendored
@@ -1,2 +1,4 @@
|
||||
*
|
||||
!teachers/
|
||||
!teachers/*
|
||||
!.gitignore
|
||||
|
||||
BIN
storage/app/private/teachers/jumash.png
Normal file
BIN
storage/app/private/teachers/jumash.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 116 KiB |
BIN
storage/app/private/teachers/nurmuhammet.png
Normal file
BIN
storage/app/private/teachers/nurmuhammet.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 277 KiB |
BIN
storage/app/private/teachers/resul.png
Normal file
BIN
storage/app/private/teachers/resul.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 328 KiB |
Reference in New Issue
Block a user