File manager - Edit - /var/www/payraty/inventory_main/app/Models/PurchaseItemReceive.php
Back
<?php namespace App\Models; use App\Traits\ProductRelationship; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; use App\Scopes\OrganisationScope; /** * PurchaseItemReceive */ class PurchaseItemReceive extends Model { use HasFactory, ProductRelationship; /** * fillable * * @var array */ public $fillable = [ 'purchase_receive_id', 'purchase_item_id', 'product_id', 'quantity', 'price', 'sub_total','product_stock_id', ]; protected static function booted() { static::addGlobalScope(new OrganisationScope); // Automatically set the organisation_id before creating the model static::creating(function ($model) { if (auth()->check()) { $model->organisation_id = auth()->user()->organisation_id; } }); } /** * purchaseReceive * * @return BelongsTo */ public function purchaseReceive(): BelongsTo { return $this->belongsTo(PurchaseReceive::class); } /** * purchaseItem * * @return BelongsTo */ public function purchaseItem(): BelongsTo { return $this->belongsTo(PurchaseItem::class); } public function productStock(): BelongsTo { return $this->belongsTo(ProductStock::class); } }
| ver. 1.4 |
Github
|
.
| PHP 8.3.30 | Generation time: 0 |
proxy
|
phpinfo
|
Settings