mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-28 12:11:08 -04:00
Merge branch 'fix-parse-condition' into 'master'
fix parse condition See merge request mohit.panjvani/crater-web!1344
This commit is contained in:
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace Crater\Models;
|
namespace Crater\Models;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
@ -14,6 +13,11 @@ class CustomField extends Model
|
|||||||
'id',
|
'id',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
protected $dates = [
|
||||||
|
'date_answer',
|
||||||
|
'date_time_answer'
|
||||||
|
];
|
||||||
|
|
||||||
protected $appends = [
|
protected $appends = [
|
||||||
'defaultAnswer',
|
'defaultAnswer',
|
||||||
];
|
];
|
||||||
@ -25,7 +29,7 @@ class CustomField extends Model
|
|||||||
public function setDateAnswerAttribute($value)
|
public function setDateAnswerAttribute($value)
|
||||||
{
|
{
|
||||||
if ($value && $value != null) {
|
if ($value && $value != null) {
|
||||||
$this->attributes['date_answer'] = Carbon::createFromFormat('Y-m-d', $value);
|
$this->attributes['date_answer'] = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,7 +43,7 @@ class CustomField extends Model
|
|||||||
public function setDateTimeAnswerAttribute($value)
|
public function setDateTimeAnswerAttribute($value)
|
||||||
{
|
{
|
||||||
if ($value && $value != null) {
|
if ($value && $value != null) {
|
||||||
$this->attributes['date_time_answer'] = Carbon::createFromFormat('Y-m-d H:i', $value);
|
$this->attributes['date_time_answer'] = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace Crater\Models;
|
namespace Crater\Models;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
@ -10,6 +9,11 @@ class CustomFieldValue extends Model
|
|||||||
{
|
{
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $dates = [
|
||||||
|
'date_answer',
|
||||||
|
'date_time_answer'
|
||||||
|
];
|
||||||
|
|
||||||
protected $guarded = [
|
protected $guarded = [
|
||||||
'id',
|
'id',
|
||||||
];
|
];
|
||||||
@ -21,7 +25,7 @@ class CustomFieldValue extends Model
|
|||||||
public function setDateAnswerAttribute($value)
|
public function setDateAnswerAttribute($value)
|
||||||
{
|
{
|
||||||
if ($value && $value != null) {
|
if ($value && $value != null) {
|
||||||
$this->attributes['date_answer'] = Carbon::createFromFormat('Y-m-d', $value);
|
$this->attributes['date_answer'] = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,7 +41,7 @@ class CustomFieldValue extends Model
|
|||||||
public function setDateTimeAnswerAttribute($value)
|
public function setDateTimeAnswerAttribute($value)
|
||||||
{
|
{
|
||||||
if ($value && $value != null) {
|
if ($value && $value != null) {
|
||||||
$this->attributes['date_time_answer'] = Carbon::createFromFormat('Y-m-d H:i', $value);
|
$this->attributes['date_time_answer'] = $value;
|
||||||
}
|
}
|
||||||
$this->attributes['time_answer'] = null;
|
$this->attributes['time_answer'] = null;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,6 +35,8 @@ class Estimate extends Model implements HasMedia
|
|||||||
'created_at',
|
'created_at',
|
||||||
'updated_at',
|
'updated_at',
|
||||||
'deleted_at',
|
'deleted_at',
|
||||||
|
'estimate_date',
|
||||||
|
'expiry_date'
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $appends = [
|
protected $appends = [
|
||||||
@ -54,20 +56,6 @@ class Estimate extends Model implements HasMedia
|
|||||||
'exchange_rate' => 'float'
|
'exchange_rate' => 'float'
|
||||||
];
|
];
|
||||||
|
|
||||||
public function setEstimateDateAttribute($value)
|
|
||||||
{
|
|
||||||
if ($value) {
|
|
||||||
$this->attributes['estimate_date'] = Carbon::createFromFormat('Y-m-d', $value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setExpiryDateAttribute($value)
|
|
||||||
{
|
|
||||||
if ($value) {
|
|
||||||
$this->attributes['expiry_date'] = Carbon::createFromFormat('Y-m-d', $value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getEstimatePdfUrlAttribute()
|
public function getEstimatePdfUrlAttribute()
|
||||||
{
|
{
|
||||||
return url('/estimates/pdf/'.$this->unique_hash);
|
return url('/estimates/pdf/'.$this->unique_hash);
|
||||||
|
|||||||
@ -16,6 +16,10 @@ class Expense extends Model implements HasMedia
|
|||||||
use InteractsWithMedia;
|
use InteractsWithMedia;
|
||||||
use HasCustomFieldsTrait;
|
use HasCustomFieldsTrait;
|
||||||
|
|
||||||
|
protected $dates = [
|
||||||
|
'expense_date',
|
||||||
|
];
|
||||||
|
|
||||||
protected $guarded = ['id'];
|
protected $guarded = ['id'];
|
||||||
|
|
||||||
protected $appends = [
|
protected $appends = [
|
||||||
@ -30,13 +34,6 @@ class Expense extends Model implements HasMedia
|
|||||||
'exchange_rate' => 'float'
|
'exchange_rate' => 'float'
|
||||||
];
|
];
|
||||||
|
|
||||||
public function setExpenseDateAttribute($value)
|
|
||||||
{
|
|
||||||
if ($value) {
|
|
||||||
$this->attributes['expense_date'] = Carbon::createFromFormat('Y-m-d', $value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function category()
|
public function category()
|
||||||
{
|
{
|
||||||
return $this->belongsTo(ExpenseCategory::class, 'expense_category_id');
|
return $this->belongsTo(ExpenseCategory::class, 'expense_category_id');
|
||||||
|
|||||||
@ -39,6 +39,8 @@ class Invoice extends Model implements HasMedia
|
|||||||
'created_at',
|
'created_at',
|
||||||
'updated_at',
|
'updated_at',
|
||||||
'deleted_at',
|
'deleted_at',
|
||||||
|
'invoice_date',
|
||||||
|
'due_date'
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
@ -61,20 +63,6 @@ class Invoice extends Model implements HasMedia
|
|||||||
'invoicePdfUrl',
|
'invoicePdfUrl',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function setInvoiceDateAttribute($value)
|
|
||||||
{
|
|
||||||
if ($value) {
|
|
||||||
$this->attributes['invoice_date'] = Carbon::createFromFormat('Y-m-d', $value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setDueDateAttribute($value)
|
|
||||||
{
|
|
||||||
if ($value) {
|
|
||||||
$this->attributes['due_date'] = Carbon::createFromFormat('Y-m-d', $value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function emailLogs()
|
public function emailLogs()
|
||||||
{
|
{
|
||||||
return $this->morphMany('App\Models\EmailLog', 'mailable');
|
return $this->morphMany('App\Models\EmailLog', 'mailable');
|
||||||
|
|||||||
@ -28,7 +28,7 @@ class Payment extends Model implements HasMedia
|
|||||||
public const PAYMENT_MODE_CREDIT_CARD = 'CREDIT_CARD';
|
public const PAYMENT_MODE_CREDIT_CARD = 'CREDIT_CARD';
|
||||||
public const PAYMENT_MODE_BANK_TRANSFER = 'BANK_TRANSFER';
|
public const PAYMENT_MODE_BANK_TRANSFER = 'BANK_TRANSFER';
|
||||||
|
|
||||||
protected $dates = ['created_at', 'updated_at'];
|
protected $dates = ['created_at', 'updated_at', 'payment_date'];
|
||||||
|
|
||||||
protected $guarded = ['id'];
|
protected $guarded = ['id'];
|
||||||
|
|
||||||
@ -54,13 +54,6 @@ class Payment extends Model implements HasMedia
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setPaymentDateAttribute($value)
|
|
||||||
{
|
|
||||||
if ($value) {
|
|
||||||
$this->attributes['payment_date'] = Carbon::createFromFormat('Y-m-d', $value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getFormattedCreatedAtAttribute($value)
|
public function getFormattedCreatedAtAttribute($value)
|
||||||
{
|
{
|
||||||
$dateFormat = CompanySetting::getSetting('carbon_date_format', $this->company_id);
|
$dateFormat = CompanySetting::getSetting('carbon_date_format', $this->company_id);
|
||||||
|
|||||||
Reference in New Issue
Block a user