Added Item model, resource and its API.
Updated Category model to have Items.
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('items', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBiginteger('category_id')->unsigned();
|
||||
$table->string('uuid');
|
||||
$table->string('name');
|
||||
$table->string('url');
|
||||
$table->string('description');
|
||||
$table->decimal('price', 8, 2);
|
||||
$table->string('image');
|
||||
|
||||
$table->foreign('category_id')->references('id')
|
||||
->on('categories')->onDelete('cascade');
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('items');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user