Skip to content

Instantly share code, notes, and snippets.

@denihida1216
Created August 17, 2020 02:48
Show Gist options
  • Save denihida1216/1bc89425bec3fc66282f88349a4462cf to your computer and use it in GitHub Desktop.
Save denihida1216/1bc89425bec3fc66282f88349a4462cf to your computer and use it in GitHub Desktop.
Laravel 7 Product Stock Model
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class ProductStock extends Model
{
protected $table = "product_stock";
protected $fillable = [
'id',
'category_detail_id',
'product_id',
'material_id',
'size_id',
'color_id',
'qty_stock',
'qty_sold',
'cost',
'price',
'discount',
'discount_expired',
'active',
'created_at',
'updated_at',
'deleted_at'
];
protected $hidden = [];
public function category_detail()
{
return $this->hasOne('App\ProductCategoryDetail', 'id', 'category_detail_id');
}
public function product()
{
return $this->hasOne('App\Product', 'id', 'product_id');
}
public function material()
{
return $this->hasOne('App\ProductMaterial', 'id', 'material_id');
}
public function size()
{
return $this->hasOne('App\ProductSize', 'id', 'size_id');
}
public function color()
{
return $this->hasOne('App\ProductColor', 'id', 'color_id');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment