Tomato PHP
Search
⌃K
✨

Start Your First CRUD

you can build a CRUD after you make a migration for your table, let's say you need to build a customer's table through this migration.
you can create a new migration
php artisan make:migration create_customers_table
and after that, you can build your customer table schema.
​
<?php
​
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
​
class CreateCustomersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('customers', function (Blueprint $table) {
$table->id();
$table->string('name')->index();
$table->longText('bio')->nullable();
$table->string('email')->unique()->index();
$table->string('phone');
$table->text('address')->nullable();
$table->timestamps();
});
}
​
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('customers');
}
}
run migration to create the table
php artisan migrate
and here is tomato step just use this command
php artisan tomato:generate
it will ask you about the table name you generate a migration for it, and if you like to use Laravel Modules, you can just say y on the next ask.
now register the menu to your config config/tomato-admin and you can find the menu class on App\Menus and clear your config
php aritsan config:cache
BOM.. your CRUD is ready.