36 lines
965 B
PHP
36 lines
965 B
PHP
<?php
|
||
|
||
namespace App\Component\Models;
|
||
|
||
use Illuminate\Database\Eloquent\Model;
|
||
|
||
class ExchangeItems extends Model
|
||
{
|
||
protected $table = 'exchange_items';
|
||
|
||
/**
|
||
* Получить информацию о действиях добавления позиции.
|
||
*/
|
||
public function create_info()
|
||
{
|
||
return $this->hasMany(ExchangeActions::class, 'order_position', 'code')
|
||
->where('exchange_actions.action_type', '=', 2);
|
||
}
|
||
|
||
/**
|
||
* Получить информацию о действиях удаления позиции.
|
||
*/
|
||
public function delete_info()
|
||
{
|
||
return $this->hasMany(ExchangeActions::class, 'order_position', 'code')
|
||
->where('exchange_actions.action_type', '=', 5);
|
||
}
|
||
|
||
/**
|
||
* Получить информацию о заказе.
|
||
*/
|
||
public function order()
|
||
{
|
||
return $this->hasOne(ExchangeOrders::class, 'code', 'order_code');
|
||
}
|
||
} |