Added Category model, resource and its API.

Updated Company model to have Categories.
This commit is contained in:
2023-06-14 16:58:35 +03:00
parent 505fa2e831
commit b5a264d92f
12 changed files with 341 additions and 0 deletions
@@ -0,0 +1,35 @@
<?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('categories', function (Blueprint $table) {
$table->id();
$table->unsignedBiginteger('company_id')->unsigned();
$table->string('uuid');
$table->string('name');
$table->string('url');
$table->foreign('company_id')->references('id')
->on('companies')->onDelete('cascade');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('categories');
}
};