Skip to content

Commit

Permalink
Merge pull request #8 from bahman026/github_action
Browse files Browse the repository at this point in the history
implement git action
  • Loading branch information
bahman026 authored Dec 21, 2024
2 parents e2372f4 + 1d033a3 commit 9caa994
Show file tree
Hide file tree
Showing 16 changed files with 100 additions and 21 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/deploy-application.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Deploy Application

on:
push:
branches:
- '*'

jobs:
create-deployment-artifact:
name: Create Deployment Artifact
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.4
tools: composer

- name: Install PHP Dependencies
working-directory: ./ShopFlow
run: |
composer install --no-interaction --prefer-dist --optimize-autoloader
- name: Compile CSS and JavaScript
working-directory: ./ShopFlow
run: |
npm ci
npm run build
- name: Setup Environment
working-directory: ./ShopFlow
run: |
cp .env.example .env
php artisan key:generate
- name: Run Pint Test
working-directory: ./ShopFlow
run: |
./vendor/bin/pint --test
- name: Run Pest Tests
working-directory: ./ShopFlow
run: |
./vendor/bin/pest
- name: Run PHPStan Analysis
working-directory: ./ShopFlow
run: |
./vendor/bin/phpstan --memory-limit=2048M analyse
5 changes: 4 additions & 1 deletion ShopFlow/app/Filament/Resources/CategoryResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ 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
2 changes: 1 addition & 1 deletion ShopFlow/phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ parameters:
- app/

# Level 9 is the highest level
level: 1
level: 5

# ignoreErrors:
# - '#PHPDoc tag @var#'
Expand Down

0 comments on commit 9caa994

Please sign in to comment.