2019-04-20 03:54:11 +02:00
|
|
|
<?php
|
2019-05-11 05:32:07 +02:00
|
|
|
/**
|
|
|
|
* Invoice Ninja (https://invoiceninja.com)
|
|
|
|
*
|
|
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
|
|
*
|
2020-01-07 01:13:47 +01:00
|
|
|
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
2019-05-11 05:32:07 +02:00
|
|
|
*
|
|
|
|
* @license https://opensource.org/licenses/AAL
|
|
|
|
*/
|
2019-04-20 03:54:11 +02:00
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
|
2019-09-12 03:28:41 +02:00
|
|
|
class Activity extends StaticModel
|
2019-04-20 03:54:11 +02:00
|
|
|
{
|
2019-04-20 14:09:40 +02:00
|
|
|
const CREATE_CLIENT=1;
|
|
|
|
const ARCHIVE_CLIENT=2;
|
|
|
|
const DELETE_CLIENT=3;
|
|
|
|
const CREATE_INVOICE=4;
|
|
|
|
const UPDATE_INVOICE=5;
|
|
|
|
const EMAIL_INVOICE=6;
|
|
|
|
const VIEW_INVOICE=7;
|
|
|
|
const ARCHIVE_INVOICE=8;
|
|
|
|
const DELETE_INVOICE=9;
|
|
|
|
const CREATE_PAYMENT=10;
|
|
|
|
//const UPDATE_PAYMENT=11;
|
|
|
|
const ARCHIVE_PAYMENT=12;
|
|
|
|
const DELETE_PAYMENT=13;
|
|
|
|
const CREATE_CREDIT=14;
|
|
|
|
//const UPDATE_CREDIT=15;
|
|
|
|
const ARCHIVE_CREDIT=16;
|
|
|
|
const DELETE_CREDIT=17;
|
|
|
|
const CREATE_QUOTE=18;
|
|
|
|
const UPDATE_QUOTE=19;
|
|
|
|
const EMAIL_QUOTE=20;
|
|
|
|
const VIEW_QUOTE=21;
|
|
|
|
const ARCHIVE_QUOTE=22;
|
|
|
|
const DELETE_QUOTE=23;
|
|
|
|
const RESTORE_QUOTE=24;
|
|
|
|
const RESTORE_INVOICE=25;
|
|
|
|
const RESTORE_CLIENT=26;
|
|
|
|
const RESTORE_PAYMENT=27;
|
|
|
|
const RESTORE_CREDIT=28;
|
|
|
|
const APPROVE_QUOTE=29;
|
|
|
|
const CREATE_VENDOR=30;
|
|
|
|
const ARCHIVE_VENDOR=31;
|
|
|
|
const DELETE_VENDOR=32;
|
|
|
|
const RESTORE_VENDOR=33;
|
|
|
|
const CREATE_EXPENSE=34;
|
|
|
|
const ARCHIVE_EXPENSE=35;
|
|
|
|
const DELETE_EXPENSE=36;
|
|
|
|
const RESTORE_EXPENSE=37;
|
|
|
|
const VOIDED_PAYMENT=39;
|
|
|
|
const REFUNDED_PAYMENT=40;
|
|
|
|
const FAILED_PAYMENT=41;
|
|
|
|
const CREATE_TASK=42;
|
|
|
|
const UPDATE_TASK=43;
|
|
|
|
const ARCHIVE_TASK=44;
|
|
|
|
const DELETE_TASK=45;
|
|
|
|
const RESTORE_TASK=46;
|
|
|
|
const UPDATE_EXPENSE=47;
|
2019-04-22 01:15:07 +02:00
|
|
|
const CREATE_USER=48;
|
|
|
|
const UPDATE_USER=49;
|
|
|
|
const ARCHIVE_USER=50;
|
|
|
|
const DELETE_USER=51;
|
|
|
|
const RESTORE_USER=52;
|
2019-11-20 06:41:49 +01:00
|
|
|
const MARK_SENT_INVOICE=53;
|
|
|
|
const PAID_INVOICE=54;
|
2019-12-22 11:28:41 +01:00
|
|
|
const EMAIL_INVOICE_FAILED=57;
|
2020-04-09 01:35:40 +02:00
|
|
|
const REVERSED_INVOICE=58;
|
|
|
|
const CANCELLED_INVOICE=59;
|
2019-11-20 06:41:49 +01:00
|
|
|
|
2019-09-17 12:27:48 +02:00
|
|
|
protected $casts = [
|
|
|
|
'is_system' => 'boolean',
|
2019-09-26 00:27:26 +02:00
|
|
|
'updated_at' => 'timestamp',
|
|
|
|
'created_at' => 'timestamp',
|
|
|
|
'deleted_at' => 'timestamp',
|
2019-09-17 12:27:48 +02:00
|
|
|
];
|
2019-04-20 14:09:40 +02:00
|
|
|
|
2020-05-06 13:49:42 +02:00
|
|
|
public function getEntityType()
|
|
|
|
{
|
|
|
|
return Activity::class;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-04-21 14:24:26 +02:00
|
|
|
public function backup()
|
|
|
|
{
|
2019-12-30 22:59:12 +01:00
|
|
|
return $this->hasOne(Backup::class);
|
2019-04-21 14:24:26 +02:00
|
|
|
}
|
2019-04-22 01:15:07 +02:00
|
|
|
|
2019-04-20 14:09:40 +02:00
|
|
|
/**
|
|
|
|
* @return mixed
|
|
|
|
*/
|
|
|
|
public function user()
|
|
|
|
{
|
|
|
|
return $this->belongsTo(User::class)->withTrashed();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return mixed
|
|
|
|
*/
|
|
|
|
public function contact()
|
|
|
|
{
|
|
|
|
return $this->belongsTo(ClientContact::class)->withTrashed();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return mixed
|
|
|
|
*/
|
|
|
|
public function client()
|
|
|
|
{
|
|
|
|
return $this->belongsTo(Client::class)->withTrashed();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return mixed
|
|
|
|
*/
|
|
|
|
public function invoice()
|
|
|
|
{
|
|
|
|
return $this->belongsTo(Invoice::class)->withTrashed();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return mixed
|
|
|
|
*/
|
|
|
|
public function payment()
|
|
|
|
{
|
|
|
|
return $this->belongsTo(Payment::class)->withTrashed();
|
|
|
|
}
|
|
|
|
|
2019-11-18 11:46:01 +01:00
|
|
|
// public function task()
|
|
|
|
// {
|
|
|
|
// return $this->belongsTo(Task::class)->withTrashed();
|
|
|
|
// }
|
2019-04-20 14:09:40 +02:00
|
|
|
|
2019-11-18 11:46:01 +01:00
|
|
|
// public function expense()
|
|
|
|
// {
|
|
|
|
// return $this->belongsTo(Expense::class)->withTrashed();
|
|
|
|
// }
|
2019-04-20 14:09:40 +02:00
|
|
|
|
2019-09-27 06:31:13 +02:00
|
|
|
public function company()
|
|
|
|
{
|
2019-11-18 11:46:01 +01:00
|
|
|
return $this->belongsTo(Company::class);
|
2019-09-27 06:31:13 +02:00
|
|
|
}
|
2019-04-20 03:54:11 +02:00
|
|
|
}
|