diff --git a/app/Console/Commands/MakeUser.php b/app/Console/Commands/MakeUser.php index 0041dfa..ac39798 100644 --- a/app/Console/Commands/MakeUser.php +++ b/app/Console/Commands/MakeUser.php @@ -106,17 +106,23 @@ class MakeUser extends Command /** * Ask for a role and return the corresponding RoleEnum. * - * @return object + * @return object{name: string, value: int|string, label: string} */ private function askRole(): object { - $options = collect(UserRoleRegistry::all())->mapWithKeys(fn(object $role) => [ - Str::ucFirst($role->label) => $role - ]); + $roles = UserRoleRegistry::all(); + $defaultRole = UserRoleRegistry::get('client'); - $choice = $this->choice('Role', $options->keys()->all(), Str::ucFirst(UserRoleRegistry::get('client')->label)); + $options = collect($roles)->mapWithKeys( + fn(object $role) => [Str::ucFirst($role->label) => $role]); + + $choice = $this->choice( + 'Role', + $options->keys()->all(), + Str::ucFirst($defaultRole->label), + ); $choiceKey = is_string($choice) ? $choice : (string) $choice[0]; - return $options->get($choiceKey) ?? UserRoleRegistry::get('client'); + return $options->get($choiceKey) ?? $defaultRole; } /** diff --git a/app/Enums/NoticeTypeEnum.php b/app/Enums/NoticeTypeEnum.php index 0931a8c..3a76e39 100644 --- a/app/Enums/NoticeTypeEnum.php +++ b/app/Enums/NoticeTypeEnum.php @@ -54,4 +54,3 @@ enum NoticeTypeEnum: int return self::CLASSES; } } - \ No newline at end of file diff --git a/app/Http/Controllers/Back/InvoiceCompanyController.php b/app/Http/Controllers/Back/InvoiceCompanyController.php index 838c5e6..6b1c432 100644 --- a/app/Http/Controllers/Back/InvoiceCompanyController.php +++ b/app/Http/Controllers/Back/InvoiceCompanyController.php @@ -48,11 +48,11 @@ class InvoiceCompanyController extends BackendController $query, $search, null, - // TODO: Fields here. + 'name', ); } $searchFields = \implode(', ', [ - // TODO: Translations here. + trans('validation.attributes.name'), ]); /** Sort columns with a query */ @@ -104,7 +104,7 @@ class InvoiceCompanyController extends BackendController { return DB::transaction(function () use ($request) { $invoice_company = new InvoiceCompany(); - $invoice_company->inertiaFill($request->validated()); + $invoice_company->fill($request->validated()); if ($invoice_company->saveOrFail()) { return redirect()->route("back.$this->modelName.edit", $invoice_company) @@ -136,7 +136,7 @@ class InvoiceCompanyController extends BackendController * Update the specified resource. * * @param \App\Http\Requests\Back\InvoiceCompanies\UpdateInvoiceCompanyRequest $request - * @param \App\Models\InvoiceCompany $invoice_company + * @param \App\Models\InvoiceCompany $invoice_company * @return \Illuminate\Http\RedirectResponse */ public function update( @@ -144,7 +144,7 @@ class InvoiceCompanyController extends BackendController InvoiceCompany $invoice_company ): \Illuminate\Http\RedirectResponse { return DB::transaction(function () use ($request, $invoice_company) { - $invoice_company->inertiaFill($request->validated()); + $invoice_company->fill($request->validated()); if ($invoice_company->saveOrFail()) { return redirect()->route("back.$this->modelName.edit", $invoice_company) diff --git a/app/Http/Controllers/Back/InvoicePackageController.php b/app/Http/Controllers/Back/InvoicePackageController.php index 8a42611..7b9df64 100644 --- a/app/Http/Controllers/Back/InvoicePackageController.php +++ b/app/Http/Controllers/Back/InvoicePackageController.php @@ -48,11 +48,11 @@ class InvoicePackageController extends BackendController $query, $search, null, - // TODO: Fields here. + 'name', ); } $searchFields = \implode(', ', [ - // TODO: Translations here. + trans('validation.attributes.name'), ]); /** Sort columns with a query */ @@ -104,7 +104,7 @@ class InvoicePackageController extends BackendController { return DB::transaction(function () use ($request) { $invoice_package = new InvoicePackage(); - $invoice_package->inertiaFill($request->validated()); + $invoice_package->fill($request->validated()); if ($invoice_package->saveOrFail()) { return redirect()->route("back.$this->modelName.edit", $invoice_package) @@ -136,7 +136,7 @@ class InvoicePackageController extends BackendController * Update the specified resource. * * @param \App\Http\Requests\Back\InvoicePackages\UpdateInvoicePackageRequest $request - * @param \App\Models\InvoicePackage $invoice_package + * @param \App\Models\InvoicePackage $invoice_package * @return \Illuminate\Http\RedirectResponse */ public function update( @@ -144,7 +144,7 @@ class InvoicePackageController extends BackendController InvoicePackage $invoice_package ): \Illuminate\Http\RedirectResponse { return DB::transaction(function () use ($request, $invoice_package) { - $invoice_package->inertiaFill($request->validated()); + $invoice_package->fill($request->validated()); if ($invoice_package->saveOrFail()) { return redirect()->route("back.$this->modelName.edit", $invoice_package) diff --git a/app/Http/Controllers/Back/NoticeController.php b/app/Http/Controllers/Back/NoticeController.php index 9cc679d..7a2e878 100644 --- a/app/Http/Controllers/Back/NoticeController.php +++ b/app/Http/Controllers/Back/NoticeController.php @@ -48,11 +48,11 @@ class NoticeController extends BackendController $query, $search, null, - // TODO: Fields here. + 'title', ); } $searchFields = \implode(', ', [ - // TODO: Translations here. + trans('validation.attributes.title'), ]); /** Sort columns with a query */ @@ -104,7 +104,7 @@ class NoticeController extends BackendController { return DB::transaction(function () use ($request) { $notice = new Notice(); - $notice->inertiaFill($request->validated()); + $notice->fill($request->validated()); if ($notice->saveOrFail()) { return redirect()->route("back.$this->modelName.edit", $notice) @@ -136,7 +136,7 @@ class NoticeController extends BackendController * Update the specified resource. * * @param \App\Http\Requests\Back\Notices\UpdateNoticeRequest $request - * @param \App\Models\Notice $notice + * @param \App\Models\Notice $notice * @return \Illuminate\Http\RedirectResponse */ public function update( @@ -144,7 +144,7 @@ class NoticeController extends BackendController Notice $notice ): \Illuminate\Http\RedirectResponse { return DB::transaction(function () use ($request, $notice) { - $notice->inertiaFill($request->validated()); + $notice->fill($request->validated()); if ($notice->saveOrFail()) { return redirect()->route("back.$this->modelName.edit", $notice) diff --git a/app/Http/Requests/Back/Notices/StoreNoticeRequest.php b/app/Http/Requests/Back/Notices/StoreNoticeRequest.php index 5067d66..a8d59bc 100644 --- a/app/Http/Requests/Back/Notices/StoreNoticeRequest.php +++ b/app/Http/Requests/Back/Notices/StoreNoticeRequest.php @@ -32,7 +32,7 @@ class StoreNoticeRequest extends FormRequest public function rules(): array { return [ - 'title' => 'required|string|min:3|max:255', + 'title' => 'required|string|between:3,255', 'message' => ['required', 'string', new WysiwygLength()], 'type' => ['required', 'integer', new Enum(NoticeTypeEnum::class)], ]; diff --git a/app/Mails/Auth/LinkResetPasswordMail.php b/app/Mails/Auth/LinkResetPasswordMail.php index 4123d2a..9c3f5c9 100644 --- a/app/Mails/Auth/LinkResetPasswordMail.php +++ b/app/Mails/Auth/LinkResetPasswordMail.php @@ -10,15 +10,20 @@ class LinkResetPasswordMail extends Mailable { /** * Create a new message instance. + * + * @param string $url + * @param mixed $user + * @return void */ public function __construct( public string $url, public mixed $user, - ) {} + ) { + } /** * Get the message envelope. - * + * * @return \Illuminate\Mail\Mailables\Envelope */ public function envelope(): \Illuminate\Mail\Mailables\Envelope @@ -35,7 +40,7 @@ class LinkResetPasswordMail extends Mailable /** * Get the message content definition. - * + * * @return \Illuminate\Mail\Mailables\Content */ public function content(): \Illuminate\Mail\Mailables\Content diff --git a/app/Mails/Auth/ResetPassword.php b/app/Mails/Auth/ResetPassword.php index 0c6919a..b7f748f 100644 --- a/app/Mails/Auth/ResetPassword.php +++ b/app/Mails/Auth/ResetPassword.php @@ -57,4 +57,4 @@ class ResetPassword extends Mailable ], ); } -} \ No newline at end of file +} diff --git a/app/Models/InvoiceCompany.php b/app/Models/InvoiceCompany.php index 114e30b..bcc5775 100644 --- a/app/Models/InvoiceCompany.php +++ b/app/Models/InvoiceCompany.php @@ -8,7 +8,6 @@ use Illuminate\Database\Eloquent\SoftDeletes; use Uwil\LaravelActivityLogs\Traits\HasActivityLog; use Uwil\LaravelBackend\Traits\Models\HasCache; use Uwil\LaravelBackend\Traits\Models\HasModelNaming; -use Uwil\LaravelBackend\Traits\Models\HasUwilImages; use Uwil\LaravelI18n\Traits\Models\HasTranslations; /** @@ -22,10 +21,10 @@ class InvoiceCompany extends Model { use HasActivityLog; use HasCache; + /** @use \Illuminate\Database\Eloquent\Factories\HasFactory<\Database\Factories\InvoiceCompanyFactory> */ use HasFactory; use HasModelNaming; use HasTranslations; - use HasUwilImages; use SoftDeletes; /** diff --git a/app/Models/InvoicePackage.php b/app/Models/InvoicePackage.php index 432b5de..32dd8b3 100644 --- a/app/Models/InvoicePackage.php +++ b/app/Models/InvoicePackage.php @@ -8,7 +8,6 @@ use Illuminate\Database\Eloquent\SoftDeletes; use Uwil\LaravelActivityLogs\Traits\HasActivityLog; use Uwil\LaravelBackend\Traits\Models\HasCache; use Uwil\LaravelBackend\Traits\Models\HasModelNaming; -use Uwil\LaravelBackend\Traits\Models\HasUwilImages; use Uwil\LaravelI18n\Traits\Models\HasTranslations; /** @@ -24,10 +23,10 @@ class InvoicePackage extends Model { use HasActivityLog; use HasCache; + /** @use \Illuminate\Database\Eloquent\Factories\HasFactory<\Database\Factories\InvoicePackageFactory> */ use HasFactory; use HasModelNaming; use HasTranslations; - use HasUwilImages; use SoftDeletes; /** diff --git a/app/Models/Notice.php b/app/Models/Notice.php index dba2d71..f22f991 100644 --- a/app/Models/Notice.php +++ b/app/Models/Notice.php @@ -9,7 +9,6 @@ use Illuminate\Database\Eloquent\SoftDeletes; use Uwil\LaravelActivityLogs\Traits\HasActivityLog; use Uwil\LaravelBackend\Traits\Models\HasCache; use Uwil\LaravelBackend\Traits\Models\HasModelNaming; -use Uwil\LaravelBackend\Traits\Models\HasUwilImages; use Uwil\LaravelI18n\Traits\Models\HasTranslations; /** @@ -25,10 +24,10 @@ class Notice extends Model { use HasActivityLog; use HasCache; + /** @use \Illuminate\Database\Eloquent\Factories\HasFactory<\Database\Factories\NoticeFactory> */ use HasFactory; use HasModelNaming; use HasTranslations; - use HasUwilImages; use SoftDeletes; /** diff --git a/app/Models/User.php b/app/Models/User.php index ea412d2..42b2163 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -43,7 +43,7 @@ class User extends BackendUser url(route('back.reset-password', ['token' => $token], false)), urlencode($this->getEmailForPasswordReset()) ); - + Mail::send(new LinkResetPasswordMail($url, $this)); } @@ -52,10 +52,10 @@ class User extends BackendUser /** * Get the user's associated password. * - * @return \Illuminate\Database\Eloquent\Relations\HasOne<\App\Models\UserPassword> + * @return \Illuminate\Database\Eloquent\Relations\HasOne<\App\Models\UserPassword,\App\Models\User> */ public function userPassword(): \Illuminate\Database\Eloquent\Relations\HasOne { return $this->hasOne(UserPassword::class); } -} \ No newline at end of file +} diff --git a/app/Models/UserPassword.php b/app/Models/UserPassword.php index fe50c68..0528ec4 100644 --- a/app/Models/UserPassword.php +++ b/app/Models/UserPassword.php @@ -5,8 +5,9 @@ namespace App\Models; use Illuminate\Database\Eloquent\Model; /** - * @property \App\Models\User $user_id User associated. - * @property string $password User password. + * @property integer $id Id of the user password. + * @property \App\Models\User $user_id Associated user. + * @property string $password Password of the user. * @property-read \Illuminate\Support\Carbon $created_at Date on which the password was created. * @property-read \Illuminate\Support\Carbon $updated_at Date on which the password was updated. */ @@ -22,4 +23,4 @@ class UserPassword extends Model 'user_id', 'password', ]; -} \ No newline at end of file +} diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 2f3e788..81571dc 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -19,4 +19,4 @@ class AppServiceProvider extends ServiceProvider UserRoleRegistry::add(4, 'developper', trans('enums.user-role.developper')); UserRoleRegistry::add(5, 'client', trans('enums.user-role.client')); } -} \ No newline at end of file +} diff --git a/database/factories/InvoiceCompanyFactory.php b/database/factories/InvoiceCompanyFactory.php index d785edd..cbeff38 100644 --- a/database/factories/InvoiceCompanyFactory.php +++ b/database/factories/InvoiceCompanyFactory.php @@ -25,7 +25,7 @@ class InvoiceCompanyFactory extends Factory public function definition(): array { return [ - "name" => fake()->word(), + "name" => fake()->words(3, true), ]; } } diff --git a/database/factories/InvoicePackageFactory.php b/database/factories/InvoicePackageFactory.php index 39521ce..8ffc5ae 100644 --- a/database/factories/InvoicePackageFactory.php +++ b/database/factories/InvoicePackageFactory.php @@ -25,7 +25,7 @@ class InvoicePackageFactory extends Factory public function definition(): array { return [ - "name" => fake()->word(), + "name" => fake()->words(3, true), "amount" => fake()->randomFloat(2, 1, 1000), "published" => fake()->boolean(75), ]; diff --git a/database/factories/NoticeFactory.php b/database/factories/NoticeFactory.php index b85f049..19eb9b3 100644 --- a/database/factories/NoticeFactory.php +++ b/database/factories/NoticeFactory.php @@ -26,7 +26,7 @@ class NoticeFactory extends Factory public function definition(): array { return [ - "title" => fake()->word(), + "title" => fake()->words(3, true), "message" => sprintf("
%s
", fake()->text(\rand(20, 40))), "type" => fake()->randomElement(NoticeTypeEnum::cases()), ]; diff --git a/database/migrations/2026_04_28_165712_add_password_reset_tokens_table.php b/database/migrations/2026_04_28_165712_add_password_reset_tokens_table.php index f9fa68c..6663db4 100644 --- a/database/migrations/2026_04_28_165712_add_password_reset_tokens_table.php +++ b/database/migrations/2026_04_28_165712_add_password_reset_tokens_table.php @@ -14,9 +14,9 @@ return new class extends Migration public function up(): void { Schema::create('user_password_reset_tokens', function (Blueprint $table): void { - $table->string('email')->primary(); - $table->string('token'); - $table->timestamp('created_at')->nullable(); + $table->string('email')->primary()->comment('Email of the user.'); + $table->string('token')->comment('Token of the password reset.'); + $table->timestamp('created_at')->nullable()->comment('Date the reset password was created.'); }); } diff --git a/lang/fr/auth.php b/lang/fr/auth.php index c00a51d..26f21b8 100644 --- a/lang/fr/auth.php +++ b/lang/fr/auth.php @@ -3,25 +3,25 @@ declare(strict_types=1); return [ - 'failed' => 'Ces identifiants ne correspondent pas à nos enregistrements.', - 'password' => 'Le mot de passe fourni est incorrect.', - 'throttle' => 'Tentatives de connexion trop nombreuses. Veuillez réessayer dans :seconds secondes.', - "login" => "Se connecter", - "remember" => "Se souvenir de moi", - "forgot_password" => "Mot de passe oublié", - "forgot_password_desc" => "Renseignez votre email pour recevoir un lien de réinitialisation.", - "description" => "Connectez-vous afin d'accéder à notre outil :appName !", - "connected" => "Connecté !", - "connected_desc" => "Vous êtes à présent authentifié au Support UWIL.", - "send_link" => "Envoyer le lien", - "mail_sent" => "Mail envoyé !", - "mail_sent_desc" => "Si un compte est associé à l'adresse :email, un e-mail de réinitialisation du mot de passe + 'failed' => 'Ces identifiants ne correspondent pas à nos enregistrements.', + 'password' => 'Le mot de passe fourni est incorrect.', + 'throttle' => 'Tentatives de connexion trop nombreuses. Veuillez réessayer dans :seconds secondes.', + "login" => "Se connecter", + "remember" => "Se souvenir de moi", + "forgot_password" => "Mot de passe oublié", + "forgot_password_desc" => "Renseignez votre email pour recevoir un lien de réinitialisation.", + "description" => "Connectez-vous afin d'accéder à notre outil :appName !", + "connected" => "Connecté !", + "connected_desc" => "Vous êtes à présent authentifié au Support UWIL.", + "send_link" => "Envoyer le lien", + "mail_sent" => "Mail envoyé !", + "mail_sent_desc" => "Si un compte est associé à l'adresse :email, un e-mail de réinitialisation du mot de passe vous sera envoyé dans quelques instants.", - "reset_password" => "Réinitialisation du mot de passe", - "reset_password_desc" => "Choisissez un nouveau mot de passe pour votre compte.", - "reset_your_password" => "Réinitialiser votre mot de passe", - "reset_sent" => "Réinitialisation du mot de passe effectué !", - "reset_sent_desc" => "Mot de passe mis à jour avec succès. Vous pouvez dès à présent vous connecter + "reset_password" => "Réinitialisation du mot de passe", + "reset_password_desc" => "Choisissez un nouveau mot de passe pour votre compte.", + "reset_your_password" => "Réinitialiser votre mot de passe", + "reset_sent" => "Réinitialisation du mot de passe effectué !", + "reset_sent_desc" => "Mot de passe mis à jour avec succès. Vous pouvez dès à présent vous connecter avec vos nouveaux identifiants.", 'email_hello' => 'Bonjour !', 'email_get_reset_password' => 'Vous recevez cet e-mail parce que nous avons reçu une demande de réinitialisation diff --git a/resources/ts/back/Components/Inputs/MultiSelect.tsx b/resources/ts/back/Components/Inputs/MultiSelect.tsx index 9af188c..54e5abc 100644 --- a/resources/ts/back/Components/Inputs/MultiSelect.tsx +++ b/resources/ts/back/Components/Inputs/MultiSelect.tsx @@ -982,7 +982,7 @@ export const MultiSelect = forwardRef+
{placeholder}