Skip to content

Commit 0870bbe

Browse files
committed
create products table
1 parent afa1b18 commit 0870bbe

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed

Diff for: app/Models/Product.php

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace App\Models;
4+
5+
use Illuminate\Database\Eloquent\Factories\HasFactory;
6+
use Illuminate\Database\Eloquent\Model;
7+
8+
class Product extends Model
9+
{
10+
use HasFactory;
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::create('products', function (Blueprint $table) {
17+
$table->id();
18+
$table->unsignedInteger('author_id');
19+
$table->unsignedInteger('category_id');
20+
$table->text('slug');
21+
$table->decimal('regular_price', 10, 0)->nullable();
22+
$table->decimal('offer_price', 10, 0)->nullable();
23+
$table->text('thumbnail_image')->nullable();
24+
$table->text('tags')->nullable();
25+
$table->text('seo_title')->nullable();
26+
$table->text('seo_description')->nullable();
27+
$table->integer('status')->default(0);
28+
$table->integer('approve_by_admin')->default(0);
29+
$table->integer('popular_item')->default(0);
30+
$table->integer('trending_item')->default(0);
31+
$table->integer('featured_item')->default(0);
32+
$table->double('average_rating')->default(0);
33+
$table->timestamps();
34+
});
35+
}
36+
37+
/**
38+
* Reverse the migrations.
39+
*
40+
* @return void
41+
*/
42+
public function down()
43+
{
44+
Schema::dropIfExists('products');
45+
}
46+
};

0 commit comments

Comments
 (0)