inital commit
This commit is contained in:
89
app/Models/Accident.php
Normal file
89
app/Models/Accident.php
Normal file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Traits\ReceiptReportAble;
|
||||
|
||||
class Accident extends Model
|
||||
{
|
||||
use ReceiptReportAble;
|
||||
public static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
self::creating(function ($model) {
|
||||
});
|
||||
|
||||
self::created(function ($model) {
|
||||
// auth()->user()->addActivityComplete(1118);
|
||||
});
|
||||
|
||||
self::updating(function ($model) {
|
||||
});
|
||||
|
||||
self::updated(function ($model) {
|
||||
});
|
||||
|
||||
self::deleting(function ($model) {
|
||||
// auth()->user()->addActivityComplete(1120,$model);
|
||||
});
|
||||
|
||||
self::deleted(function ($model) {
|
||||
});
|
||||
}
|
||||
|
||||
public function damages()
|
||||
{
|
||||
return $this->belongsToMany('App\Models\Damage')->withPivot('unit', 'amount', 'value');
|
||||
}
|
||||
|
||||
|
||||
public function withoutAction()
|
||||
{
|
||||
if ($this->status == 0) {
|
||||
$this->status_fa = "بدون اقدام";
|
||||
}
|
||||
}
|
||||
|
||||
public function sendToInsurance()
|
||||
{
|
||||
if ($this->status == 0) {
|
||||
$this->status_fa = "صدور نامه بیمه و کارشناسی داغی";
|
||||
$this->status = 1;
|
||||
}
|
||||
}
|
||||
|
||||
public function receiveInsuranceAndDaqiBill()
|
||||
{
|
||||
if ($this->status == 1) {
|
||||
$this->status_fa = "فیش ها ثبت شده است.";
|
||||
$this->status = 2;
|
||||
}
|
||||
}
|
||||
|
||||
public function invoiceBill()
|
||||
{
|
||||
if ($this->status == 2) {
|
||||
$this->status_fa = "فاکتور صادر شده است.";
|
||||
$this->status = 3;
|
||||
}
|
||||
}
|
||||
|
||||
public function payBill()
|
||||
{
|
||||
if ($this->status == 3) {
|
||||
$this->status_fa = "فاکتور پرداخت شده است";
|
||||
$this->status = 4;
|
||||
}
|
||||
}
|
||||
|
||||
public function documentRelease()
|
||||
{
|
||||
if ($this->status == 4) {
|
||||
$this->status_fa = "نامه پلیس راه صادر شده است (اتمام فرایند)";
|
||||
$this->status = 5;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user