<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
eng-mohamedemad-dev / command-module-generator example snippets
artisan make:module Car # توليد موديل/خدمة/كنترولر... افتراضي web
php artisan make:module Invoice --type=api --repo # توليد كل شيء كموديول API+ توليد repository
---php artisan make:module Ticket --path=admin/tickets # وضع الواجهات بمجلد معين
php artisan make:module Post --no-policy # يعطّل توليد البوليصي فقط
## ⚙️ Optionsphp artisan make:module City --requests-mode=single # يولد ملف request واحد فقط
| Option | Description |php artisan delete:module Car # يحذف كل ملفات موديول Car (كل ما تم توليده)
|--------|-------------|
// Controller → Service → Model/Repository
class CarController extends Controller
{
public function __construct(private CarService $service) {}
public function index(Request $request)
{
$data = $this->service->list(15);
return CarResource::collection($data);
}
}
public function register(): void
{
$this->app->bind(\App\Interfaces\CarInterface::class, \App\Services\CarService::class);
$this->app->bind(\App\Interfaces\CarRepositoryInterface::class, \App\Repositories\CarRepository::class);
}
use Illuminate\Database\Eloquent\Attributes\UsePolicy;
use Illuminate\Database\Eloquent\Attributes\ObservedBy;
#[UsePolicy(CarPolicy::class)]
#[ObservedBy([CarObserver::class])]
class Car extends Model
{
//
}