IMMREX7
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use Carbon\Carbon;
class StockInvoicePayment extends Model {
protected $primaryKey = 'idInvoicePayment';
protected $table = 'stock_invoicepayment';
protected $fillable = ['idSchool', 'idInvoice', 'paidAmount', 'cardNo', 'paymentMode', 'paymentStatus', 'idBank',
'chequeNo', 'chequeDate','idAccount','utr','utrFile','created_by','discount'];
public function getPaymentDateAttribute($date) {
if ($date && $date != '0000-00-00' && $date != 'null')
return Carbon::parse($date)->format('d-m-Y');
return '';
}
public function setChequeDateAttribute($date) {
if (strlen($date) > 0)
$this->attributes['chequeDate'] = Carbon::createFromFormat('d-m-Y', $date);
else
$this->attributes['chequeDate'] = null;
}
public function getChequeDateAttribute($date) {
if ($date && $date != '0000-00-00' && $date != 'null')
return Carbon::parse($date)->format('d-m-Y');
return '';
}
public function bank() {
return $this->belongsTo(Bank::class, 'idBank', 'idBank');
}
}
Copyright © 2021 -