Created
August 17, 2020 02:48
-
-
Save denihida1216/1bc89425bec3fc66282f88349a4462cf to your computer and use it in GitHub Desktop.
Laravel 7 Product Stock Model
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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