style updates

This commit is contained in:
Mark Gregory
2026-07-24 14:59:44 +01:00
parent 24ab771cd3
commit dd23205d0b
482 changed files with 7173 additions and 1435 deletions
@@ -4,7 +4,20 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
public function up(): void { Schema::create('products', function (Blueprint $table): void { $table->id(); $table->string('name'); $table->boolean('is_active')->default(true); $table->timestamps(); }); }
public function down(): void { Schema::dropIfExists('products'); }
return new class extends Migration
{
public function up(): void
{
Schema::create('products', function (Blueprint $table): void {
$table->id();
$table->string('name');
$table->boolean('is_active')->default(true);
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('products');
}
};
@@ -17,6 +17,7 @@ final class ProductController
public function store(StoreProductRequest $request): RedirectResponse
{
Product::query()->create($request->validated());
return back()->with('status', 'Product created.');
}
}
@@ -6,6 +6,13 @@ use Illuminate\Foundation\Http\FormRequest;
final class StoreProductRequest extends FormRequest
{
public function authorize(): bool { return $this->user() !== null; }
public function rules(): array { return ['name' => ['required', 'string', 'max:255'], 'is_active' => ['sometimes', 'boolean']]; }
public function authorize(): bool
{
return $this->user() !== null;
}
public function rules(): array
{
return ['name' => ['required', 'string', 'max:255'], 'is_active' => ['sometimes', 'boolean']];
}
}
@@ -2,4 +2,6 @@
use Modules\Products\Models\Product;
it('can create a Product', function (): void { expect(Product::query()->create(['name' => 'Example']))->toBeInstanceOf(Product::class); });
it('can create a Product', function (): void {
expect(Product::query()->create(['name' => 'Example']))->toBeInstanceOf(Product::class);
});
@@ -1,5 +1,7 @@
<?php
use Modules\Products\Providers\ProductsServiceProvider;
it('boots the Products module', function (): void {
expect(app()->providerIsLoaded(Modules\Products\Providers\ProductsServiceProvider::class))->toBeTrue();
expect(app()->providerIsLoaded(ProductsServiceProvider::class))->toBeTrue();
});