Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
bahman026 committed Dec 21, 2024
1 parent 3fff445 commit 5e276cf
Show file tree
Hide file tree
Showing 14 changed files with 47 additions and 20 deletions.
4 changes: 3 additions & 1 deletion ShopFlow/app/Filament/Resources/CategoryResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ public static function table(Table $table): Table
->sortable(),
Tables\Columns\ImageColumn::make('images')
->getStateUsing(function (Category $record) {
return $record->images->first()?->path;
/** @var \Illuminate\Database\Eloquent\Collection|\App\Models\Image[] $images */
$images = $record->images;
return $images->first()?->path;
}),

Tables\Columns\TextColumn::make('created_at')
Expand Down
2 changes: 1 addition & 1 deletion ShopFlow/app/Filament/Resources/UserResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public static function getEloquentQuery(): Builder
$query = parent::getEloquentQuery();
$query->whereNot('id', auth()->id());
if (! auth()->user()->hasRole(RolesEnum::SUPER_ADMIN->value) && auth()->user()->hasRole(RolesEnum::ADMIN->value)) {
$query->withoutRole(RolesEnum::SUPER_ADMIN->value);
$query->withoutRole(RolesEnum::SUPER_ADMIN->value); // @phpstan-ignore-line
}

return $query;
Expand Down
1 change: 0 additions & 1 deletion ShopFlow/app/Models/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ class Category extends Model
'status',
];


public function images(): MorphMany
{
return $this->morphMany(Image::class, 'imageable');
Expand Down
1 change: 0 additions & 1 deletion ShopFlow/app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,3 @@ public function boot(): void
//
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ public function up(): void
$table->string('last_name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('mobile',20)->nullable();
$table->string('mobile', 20)->nullable();
$table->timestamp('mobile_verified_at')->nullable();
$table->string('national_id',10)->nullable();
$table->string('national_id', 10)->nullable();
$table->string('password');
$table->unsignedTinyInteger('status')->default(\App\Enums\UserStatusEnum::ACTIVE->value);
$table->rememberToken();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
declare(strict_types=1);

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
Expand Down Expand Up @@ -66,11 +68,15 @@ public function up(): void
$table->unsignedBigInteger($columnNames['team_foreign_key']);
$table->index($columnNames['team_foreign_key'], 'model_has_permissions_team_foreign_key_index');

$table->primary([$columnNames['team_foreign_key'], $pivotPermission, $columnNames['model_morph_key'], 'model_type'],
'model_has_permissions_permission_model_type_primary');
$table->primary(
[$columnNames['team_foreign_key'], $pivotPermission, $columnNames['model_morph_key'], 'model_type'],
'model_has_permissions_permission_model_type_primary'
);
} else {
$table->primary([$pivotPermission, $columnNames['model_morph_key'], 'model_type'],
'model_has_permissions_permission_model_type_primary');
$table->primary(
[$pivotPermission, $columnNames['model_morph_key'], 'model_type'],
'model_has_permissions_permission_model_type_primary'
);
}

});
Expand All @@ -90,11 +96,15 @@ public function up(): void
$table->unsignedBigInteger($columnNames['team_foreign_key']);
$table->index($columnNames['team_foreign_key'], 'model_has_roles_team_foreign_key_index');

$table->primary([$columnNames['team_foreign_key'], $pivotRole, $columnNames['model_morph_key'], 'model_type'],
'model_has_roles_role_model_type_primary');
$table->primary(
[$columnNames['team_foreign_key'], $pivotRole, $columnNames['model_morph_key'], 'model_type'],
'model_has_roles_role_model_type_primary'
);
} else {
$table->primary([$pivotRole, $columnNames['model_morph_key'], 'model_type'],
'model_has_roles_role_model_type_primary');
$table->primary(
[$pivotRole, $columnNames['model_morph_key'], 'model_type'],
'model_has_roles_role_model_type_primary'
);
}
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<?php

declare(strict_types=1);

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class() extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<?php

declare(strict_types=1);

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class() extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<?php

declare(strict_types=1);

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class() extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
<?php

declare(strict_types=1);

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration {
return new class extends Migration
{
/**
* Run the migrations.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
Expand Down

0 comments on commit 5e276cf

Please sign in to comment.