-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* wip kebab * wip * fix opening hours, add order options * add sauce, filling, fix kebab * tabs * wip update factories and admin views * enums, requests validation * change rating * request validation, empty lines * imports * test and lint php * composer.lock * fix * composer * app key * fix * street, building number -> address * wip kebab_data.json * add all kebab places, add new kebab places, seeder wip, rm columns * gitignore * wip img * wip img * images * empty line * cr changes + data fix * cr changes
- Loading branch information
1 parent
6748bfe
commit 572a18d
Showing
149 changed files
with
6,825 additions
and
2,230 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: Test & lint PHP codebase | ||
|
||
on: | ||
pull_request: | ||
branches: [ "main" ] | ||
types: [opened, synchronize, reopened, ready_for_review] | ||
paths: | ||
- '**.php' | ||
- 'composer.json' | ||
- 'composer.lock' | ||
- 'phpunit.xml' | ||
- 'env.ci' | ||
|
||
jobs: | ||
test-and-lint-php: | ||
name: Test & lint PHP codebase | ||
timeout-minutes: 10 | ||
if: github.event.pull_request.draft == false | ||
runs-on: ubuntu-22.04 | ||
services: | ||
pgsql: | ||
image: postgres:15.2-alpine3.17 | ||
env: | ||
POSTGRES_DB: escooters | ||
POSTGRES_USER: escooters | ||
POSTGRES_PASSWORD: password | ||
# Set health checks to wait until postgres has started | ||
options: >- | ||
--health-cmd pg_isready | ||
--health-interval 3s | ||
--health-timeout 3s | ||
--health-retries 5 | ||
ports: | ||
- 5432:5432 | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Validate composer.json and composer.lock | ||
run: composer validate | ||
|
||
- name: Cache dependencies | ||
uses: actions/cache@v4 | ||
with: | ||
path: vendor | ||
key: ${{ runner.os }}-composer-dependencies-${{ hashFiles('composer.lock') }} | ||
restore-keys: ${{ runner.os }}-composer-dependencies | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 8.3 | ||
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, pdo_pgsql, intl | ||
coverage: none | ||
|
||
- name: Install Composer dependencies | ||
run: composer install --prefer-dist --no-interaction | ||
|
||
- name: Run PHP linter | ||
run: composer cs | ||
|
||
- name: Execute tests | ||
run: php artisan test --env=ci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,3 +19,4 @@ google-credentials.json | |
.composer | ||
/public/build/ | ||
supervisord.pid | ||
.php-cs-fixer.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Actions; | ||
|
||
use App\Models\KebabPlace; | ||
|
||
class RemoveFillingFromKebabAction | ||
{ | ||
public function execute(int $fillingId): void | ||
{ | ||
KebabPlace::query()->whereJsonContains("fillings", $fillingId)->get() | ||
->each(function (KebabPlace $kebabPlace) use ($fillingId): void { | ||
$kebabPlace->fillings = array_values(array_diff($kebabPlace->fillings, [$fillingId])); | ||
$kebabPlace->save(); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Actions; | ||
|
||
use App\Models\KebabPlace; | ||
|
||
class RemoveSauceFromKebabAction | ||
{ | ||
public function execute(int $sauceId): void | ||
{ | ||
KebabPlace::query()->whereJsonContains("sauces", $sauceId)->get() | ||
->each(function (KebabPlace $kebabPlace) use ($sauceId): void { | ||
$kebabPlace->sauces = array_values(array_diff($kebabPlace->sauces, [$sauceId])); | ||
$kebabPlace->save(); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Enums; | ||
|
||
use Filament\Support\Contracts\HasLabel; | ||
|
||
enum KebabPlaceLocationType: string implements HasLabel | ||
{ | ||
case dineIn = "lokal"; | ||
case foodStand = "buda"; | ||
|
||
public function getLabel(): ?string | ||
{ | ||
return match ($this) { | ||
self::dineIn => "Lokal", | ||
self::foodStand => "Buda", | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Enums; | ||
|
||
use Filament\Support\Contracts\HasLabel; | ||
|
||
enum KebabPlaceStatus: string implements HasLabel | ||
{ | ||
case open = "otwarte"; | ||
case closed = "zamknięte"; | ||
case planned = "planowane"; | ||
|
||
public function getLabel(): ?string | ||
{ | ||
return match ($this) { | ||
self::open => "Otwarte", | ||
self::closed => "Zamknięte", | ||
self::planned => "Planowane", | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,24 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Exceptions; | ||
|
||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; | ||
use Throwable; | ||
|
||
class Handler extends ExceptionHandler | ||
{ | ||
/** | ||
* | ||
* @var array<int, string> | ||
*/ | ||
/** @var array<int, string> */ | ||
protected $dontFlash = [ | ||
'current_password', | ||
'password', | ||
'password_confirmation', | ||
"current_password", | ||
"password", | ||
"password_confirmation", | ||
]; | ||
|
||
public function register(): void | ||
{ | ||
$this->reportable(function (Throwable $e) { | ||
|
||
$this->reportable(function (Throwable $e): void { | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Filament\Resources; | ||
|
||
use App\Filament\Resources\FillingResource\Pages; | ||
use App\Models\Filling; | ||
use Filament\Forms\Components\Checkbox; | ||
use Filament\Forms\Components\ColorPicker; | ||
use Filament\Forms\Components\Section; | ||
use Filament\Forms\Components\TextInput; | ||
use Filament\Forms\Form; | ||
use Filament\Resources\Resource; | ||
use Filament\Tables; | ||
use Filament\Tables\Columns\ColorColumn; | ||
use Filament\Tables\Columns\IconColumn; | ||
use Filament\Tables\Columns\TextColumn; | ||
use Filament\Tables\Table; | ||
|
||
class FillingResource extends Resource | ||
{ | ||
public static function form(Form $form): Form | ||
{ | ||
return $form | ||
->schema([ | ||
Section::make([ | ||
TextInput::make("name") | ||
->label("Nazwa") | ||
->required() | ||
->maxLength(255), | ||
ColorPicker::make("hex_color") | ||
->label("Kolor") | ||
->required(), | ||
Checkbox::make("is_vege") | ||
->label("Czy wege?") | ||
->default(false), | ||
]), | ||
]); | ||
} | ||
|
||
public static function table(Table $table): Table | ||
{ | ||
return $table | ||
->columns([ | ||
TextColumn::make("name") | ||
->label("Nazwa") | ||
->sortable() | ||
->searchable(), | ||
IconColumn::make("is_vege") | ||
->label("Wege") | ||
->boolean() | ||
->sortable(), | ||
ColorColumn::make("hex_color") | ||
->label("Kolor") | ||
->sortable(), | ||
]) | ||
->actions([ | ||
Tables\Actions\EditAction::make(), | ||
Tables\Actions\DeleteAction::make(), | ||
]) | ||
->bulkActions([ | ||
Tables\Actions\BulkActionGroup::make([ | ||
Tables\Actions\DeleteBulkAction::make(), | ||
]), | ||
]); | ||
} | ||
|
||
public static function getPages(): array | ||
{ | ||
return [ | ||
"index" => Pages\ListFillings::route("/"), | ||
"create" => Pages\CreateFilling::route("/create"), | ||
"edit" => Pages\EditFilling::route("/{record}/edit"), | ||
]; | ||
} | ||
|
||
protected static ?string $model = Filling::class; | ||
protected static ?string $label = "główny składnik"; | ||
protected static ?string $pluralLabel = "Główne składniki"; | ||
protected static ?string $navigationIcon = "heroicon-o-circle-stack"; | ||
} |
13 changes: 13 additions & 0 deletions
13
app/Filament/Resources/FillingResource/Pages/CreateFilling.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Filament\Resources\FillingResource\Pages; | ||
|
||
use App\Filament\Resources\FillingResource; | ||
use Filament\Resources\Pages\CreateRecord; | ||
|
||
class CreateFilling extends CreateRecord | ||
{ | ||
protected static string $resource = FillingResource::class; | ||
} |
21 changes: 21 additions & 0 deletions
21
app/Filament/Resources/FillingResource/Pages/EditFilling.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Filament\Resources\FillingResource\Pages; | ||
|
||
use App\Filament\Resources\FillingResource; | ||
use Filament\Actions; | ||
use Filament\Resources\Pages\EditRecord; | ||
|
||
class EditFilling extends EditRecord | ||
{ | ||
protected static string $resource = FillingResource::class; | ||
|
||
protected function getHeaderActions(): array | ||
{ | ||
return [ | ||
Actions\DeleteAction::make(), | ||
]; | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
app/Filament/Resources/FillingResource/Pages/ListFillings.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Filament\Resources\FillingResource\Pages; | ||
|
||
use App\Filament\Resources\FillingResource; | ||
use Filament\Actions; | ||
use Filament\Resources\Pages\ListRecords; | ||
|
||
class ListFillings extends ListRecords | ||
{ | ||
protected static string $resource = FillingResource::class; | ||
|
||
protected function getHeaderActions(): array | ||
{ | ||
return [ | ||
Actions\CreateAction::make(), | ||
]; | ||
} | ||
} |
Oops, something went wrong.