# Generate CRUD

to generate a new CRUD from any table on  your tomato-php generated CRUDs just need to run this command

```
php artisan tomato-flutter:crud
```

now you will get a new module inside your app dir `/flutter/APP_NAME/lib/app/modules/TABLE_NAME` to allow your module inside `/flutter/APP_NAME/lib/app/modules/Modules.dart` add this line

```dart
export 'Auth/AuthModule.dart';
export "Dashboard/DashboardModule.dart";
export "Settings/SettingsModule.dart";
export "Splash/SplashModule.dart";
export "Profile/ProfileModule.dart";
export "Forms/FormsModule.dart";
export "TABLE_NAME/TABLE_NAMEModule.dart";
```

and after that allow the modules to route inside the file `/flutter/APP_NAME/lib/routes/Router.dart` add this line

```dart
import 'package:get/get.dart';

import '/app/modules/Modules.dart';

List<GetPage> routes = [
  /// Basic Routes
  ...splashRoutes,

  /// Auth Routes
  ...authRoutes,

  /// Dashboard Routes
  ...dashboardRoutes,

  /// Setting Routes
  ...settingsRoutes,

  /// Profile Routes
  ...profileRoutes,

  ...formsRoutes,

  ...tableNameRoutes,
];
```

### Add Endpoints to Backend

please note that the generated files will match only APIs generated by TomatoPHP and you need to add APIs routes to the api.php&#x20;

```php
Route::middleware(['auth:sanctum'])->name('api.')->group(function () {
    Route::get('customers', [\Modules\Customers\Http\Controllers\CustomerController::class, 'index'])->name('customers.index');
    Route::post('customers', [\Modules\Customers\Http\Controllers\CustomerController::class, 'store'])->name('customers.store');
    Route::get('customers/{model}', [\Modules\Customers\Http\Controllers\CustomerController::class, 'show'])->name('customers.show');
    Route::post('customers/{model}', [\Modules\Customers\Http\Controllers\CustomerController::class, 'update'])->name('customers.update');
    Route::delete('customers/{model}', [\Modules\Customers\Http\Controllers\CustomerController::class, 'destroy'])->name('customers.destroy');
});Change Endpoint
```
