12345678910111213141516171819202122232425262728293031 |
- <?php
- namespace App\Models;
- use Illuminate\Database\Eloquent\Model;
- class OrderDetailW extends Model
- {
- protected $connection = 'mysql_w';
- protected $table='order_detail';
- protected $fillable=['order_no','order_id','goods_id','user_id','store_id','price','cost_price','origin_price','num','account','size','type','style'];
- public function goods(){
- return $this->hasOne(StoreGoods::class,'id','goods_id');
- }
- public function order(){
- return $this->belongsTo(OrderW::class,'order_id','id');
- }
- public function getPriceAttribute($value){
- return round($value);
- }
- public function getCostPriceAttribute($value){
- return round($value);
- }
- public function getCostAccountAttribute($value){
- return round($value);
- }
- public function getAccountAttribute($value){
- return round($value);
- }
- }
|