File "PurchaseOrderToCreate.php"
Full Path: /home/clickysoft/public_html/jmapi5.clickysoft.net/app/Models/PurchaseOrderToCreate.php
File size: 772 bytes
MIME-type: text/x-php
Charset: utf-8
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
class PurchaseOrderToCreate extends Model
{
use HasFactory;
protected $table = 'purchase_order_to_create';
protected $fillable = [
'order_id',
'order_item_id',
'product_id',
'price_id',
'quantity',
'created_at',
'updated_at',
];
public function order()
{
return $this->belongsTo(Order::class, 'order_id');
}
public function orders(): HasMany
{
return $this->hasMany(PurchaseOrderToCreate::class, 'product_id', 'product_id')
->where('price_id', $this->price_id);
}
}