Skip to content

Commit

Permalink
Update to laravel 11
Browse files Browse the repository at this point in the history
Fixes #11
  • Loading branch information
sylfel committed Mar 19, 2024
1 parent 6e2f458 commit 0f2abbb
Show file tree
Hide file tree
Showing 17 changed files with 573 additions and 550 deletions.
2 changes: 0 additions & 2 deletions app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,5 @@ protected function schedule(Schedule $schedule): void
protected function commands(): void
{
$this->load(__DIR__.'/Commands');

require base_path('routes/console.php');
}
}
6 changes: 0 additions & 6 deletions app/Http/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,6 @@ class Kernel extends HttpKernel
\App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],

'api' => [
// \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
\Illuminate\Routing\Middleware\ThrottleRequests::class.':api',
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
];

/**
Expand Down
14 changes: 11 additions & 3 deletions app/Livewire/Dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,28 +44,32 @@ public function addToCategoryAction(): Action
$category = Category::with('postes')->find($arguments['category']);
$fields = [
TextInput::make('price')
->translateLabel()
->numeric()
->inputMode('decimal')
->required(),
TextInput::make('label')
->translateLabel()
->required($category->postes->count() == 0)
->maxLength(255),
Select::make('user_id')
->translateLabel()
->relationship(name: 'user', titleAttribute: 'name')
->default(Auth::id())
->required(),
];
if ($category->postes->count() > 0) {
$select = Select::make('poste_id')
->translateLabel()
->label('Post')
->required()
->label('Poste')
->options($category->postes->pluck('label', 'id'));
array_splice($fields, 1, 0, [$select]);
}

return $fields;
})
->label('Add note')
->translateLabel()
->labeledFrom('md')
->button()
->outlined()
Expand All @@ -89,20 +93,24 @@ public function editNoteAction(): Action
$category = Category::with('postes')->find($record->category_id);
$fields = [
TextInput::make('price')
->translateLabel()
->numeric()
->inputMode('decimal')
->required(),
TextInput::make('label')
->translateLabel()
->required($category->postes->count() == 0)
->maxLength(255),
Select::make('user_id')
->translateLabel()
->relationship(name: 'user', titleAttribute: 'name')
->required(),
];
if ($category->postes->count() > 0) {
$select = Select::make('poste_id')
->required()
->label('Poste')
->label('Post')
->translateLabel()
->options($category->postes->pluck('label', 'id'));
array_splice($fields, 1, 0, [$select]);
}
Expand Down
16 changes: 10 additions & 6 deletions app/Livewire/ListCategory.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,30 @@ public function table(Table $table): Table
->query(Category::query())
->columns([
TextColumn::make('label'),
ToggleColumn::make('credit'),
ToggleColumn::make('extra'),
ToggleColumn::make('credit')
->translateLabel(),
ToggleColumn::make('extra')
->translateLabel(),
])
->headerActions([
CreateAction::make()
->form([
TextInput::make('label')
->translateLabel()
->required(),
Toggle::make('credit'),
Toggle::make('extra'),
Toggle::make('credit')->translateLabel(),
Toggle::make('extra')->translateLabel(),
]),
])
->actions([
EditAction::make()
->iconButton()
->form([
TextInput::make('label')
->translateLabel()
->required(),
Toggle::make('credit'),
ToggleColumn::make('extra'),
Toggle::make('credit')->translateLabel(),
Toggle::make('extra')->translateLabel(),
]),
DeleteAction::make()
->iconButton(),
Expand Down
4 changes: 4 additions & 0 deletions app/Livewire/ListPoste.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ public function table(Table $table): Table
CreateAction::make()
->form([
TextInput::make('label')
->translateLabel()
->required(),
Select::make('category_id')
->translateLabel()
->relationship(name: 'category', titleAttribute: 'label')
->required(),
]),
Expand All @@ -48,8 +50,10 @@ public function table(Table $table): Table
->iconButton()
->form([
TextInput::make('label')
->translateLabel()
->required(),
Select::make('category_id')
->translateLabel()
->relationship(name: 'category', titleAttribute: 'label')
->required(),
]),
Expand Down
3 changes: 3 additions & 0 deletions app/Models/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;

/**
* @property-read int|null $notes_sum_price
*/
class Category extends Model
{
use HasFactory;
Expand Down
11 changes: 0 additions & 11 deletions app/Providers/RouteServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@

namespace App\Providers;

use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Support\Facades\Route;

class RouteServiceProvider extends ServiceProvider
Expand All @@ -24,15 +21,7 @@ class RouteServiceProvider extends ServiceProvider
*/
public function boot(): void
{
RateLimiter::for('api', function (Request $request) {
return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());
});

$this->routes(function () {
Route::middleware('api')
->prefix('api')
->group(base_path('routes/api.php'));

Route::middleware('web')
->group(base_path('routes/web.php'));
});
Expand Down
26 changes: 13 additions & 13 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,26 @@
"license": "MIT",
"require": {
"php": "^8.2",
"filament/actions": "^v3.2.47",
"filament/notifications": "v3.2.47",
"filament/tables": "^3.2",
"filament/actions": "v3.2.53",
"filament/notifications": "v3.2.53",
"filament/tables": "v3.2.53",
"guzzlehttp/guzzle": "^7.8.1",
"laravel/framework": "v10.47.0",
"laravel/sanctum": "^v3.3.3",
"laravel/framework": "v11.0.7",
"laravel/sanctum": "v4.0.0",
"laravel/tinker": "^v2.9.0",
"livewire/livewire": "v3.4.8",
"livewire/volt": "^v1.6.2"
"livewire/livewire": "v3.4.9",
"livewire/volt": "v1.6.3"
},
"require-dev": {
"barryvdh/laravel-debugbar": "v3.11.0",
"barryvdh/laravel-debugbar": "v3.12.2",
"fakerphp/faker": "^v1.23.1",
"larastan/larastan": "v2.9.2",
"laravel/breeze": "v1.29.1",
"laravel/breeze": "v2.0.0",
"laravel/pint": "v1.14.0",
"laravel/sail": "v1.28.2",
"mockery/mockery": "^1.6.7",
"nunomaduro/collision": "^7.10.0",
"pestphp/pest": "v2.34.1",
"laravel/sail": "v1.29.0",
"mockery/mockery": "^1.6.9",
"nunomaduro/collision": "^v8.1.1",
"pestphp/pest": "v2.34.4",
"pestphp/pest-plugin-laravel": "v2.3.0",
"spatie/laravel-ignition": "^2.4.2"
},
Expand Down
Loading

0 comments on commit 0f2abbb

Please sign in to comment.