Вход Регистрация
Файл: src/app/Models/Invoices.php
Строк: 50
<?php 
namespace AppModels;

use 
IlluminateDatabaseEloquentModel;

class 
Invoices extends Model{
    protected 
$table "Invoices";
    protected 
$primaryKey "InvoiceID";
    protected 
$appends = ['style'];

    protected 
$fillable = [
            
'CompanyID',
            
'ReferenceID',
            
'Discount',
            
'DiscountPercentage',
            
'DiscountMethod',
            
'Tax',
            
'TaxAmount',
            
'DueDate',
            
'Status',
            
'Content',
            
'CurrencyID',
            
'Total',
            
'Subtotal'];
    protected 
$dates = ["DueDate","CreatedAt","DeletedAt","UpdatedAt"];
    const 
CREATED_AT "CreatedAt";
    const 
UPDATED_AT "UpdatedAt";
    const 
DELETED_AT "DeletedAt";

    public function 
items(){
        return 
$this->hasMany("AppModelsItems","InvoiceID","InvoiceID");
    }
    public function 
company(){
        return 
$this->hasOne("AppModelsCompanies","CompanyID","CompanyID");
    }
    public function 
currency(){
        return 
$this->hasOne("AppModelsCurrencies","CurrencyID","CurrencyID");
    }
    public function 
getStyleAttribute(){
        
$Default "danger";
        
$Val $this->attributes["Status"];
        if (
$Val=="Paid") {
            
$Default "success";
        }else if(
$Val=="Pending"){
            
        }else if(
$Val=="Partially Paid"){
            
$Default "partially-paid";
        }else if(
$Val=="Closed"){
            
$Default "closed";
        }else {
            
$Default "duplicate";
        }
        return 
$Default;
    }
}
?>
Онлайн: 3
Реклама