Some checks failed
Admin | Playwright Tests / Admin | Playwright Tests | Shard 1 Of 6 (push) Failing after 37s
Admin | Playwright Tests / Admin | Playwright Tests | Shard 2 Of 6 (push) Failing after 7s
Admin | Playwright Tests / Admin | Playwright Tests | Shard 4 Of 6 (push) Failing after 7s
Admin | Playwright Tests / Admin | Playwright Tests | Shard 6 Of 6 (push) Failing after 6s
Linting Tests / PHP 8.3 test on ubuntu-latest (push) Failing after 5s
CI / PHP 8.3 test on ubuntu-latest (push) Failing after 6s
Skills Consistency / validate-skills (push) Successful in 10s
Admin | Playwright Tests / Admin | Playwright Tests | Shard 3 Of 6 (push) Failing after 7s
Admin | Playwright Tests / Admin | Playwright Tests | Shard 5 Of 6 (push) Failing after 6s
112 lines
2.4 KiB
PHP
112 lines
2.4 KiB
PHP
<?php
|
|
|
|
namespace Webkul\Activity\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Webkul\Activity\Contracts\Activity as ActivityContract;
|
|
use Webkul\Contact\Models\PersonProxy;
|
|
use Webkul\Lead\Models\LeadProxy;
|
|
use Webkul\Product\Models\ProductProxy;
|
|
use Webkul\User\Models\UserProxy;
|
|
use Webkul\Warehouse\Models\WarehouseProxy;
|
|
|
|
class Activity extends Model implements ActivityContract
|
|
{
|
|
/**
|
|
* Define table name of property
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $table = 'activities';
|
|
|
|
/**
|
|
* Define relationships that should be touched on save
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $with = ['user'];
|
|
|
|
/**
|
|
* Cast attributes to date time
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $casts = [
|
|
'schedule_from' => 'datetime',
|
|
'schedule_to' => 'datetime',
|
|
];
|
|
|
|
/**
|
|
* The attributes that are mass assignable.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $fillable = [
|
|
'title',
|
|
'type',
|
|
'location',
|
|
'comment',
|
|
'additional',
|
|
'schedule_from',
|
|
'schedule_to',
|
|
'is_done',
|
|
'user_id',
|
|
];
|
|
|
|
/**
|
|
* Get the user that owns the activity.
|
|
*/
|
|
public function user()
|
|
{
|
|
return $this->belongsTo(UserProxy::modelClass());
|
|
}
|
|
|
|
/**
|
|
* The participants that belong to the activity.
|
|
*/
|
|
public function participants()
|
|
{
|
|
return $this->hasMany(ParticipantProxy::modelClass());
|
|
}
|
|
|
|
/**
|
|
* Get the file associated with the activity.
|
|
*/
|
|
public function files()
|
|
{
|
|
return $this->hasMany(FileProxy::modelClass(), 'activity_id');
|
|
}
|
|
|
|
/**
|
|
* The leads that belong to the activity.
|
|
*/
|
|
public function leads()
|
|
{
|
|
return $this->belongsToMany(LeadProxy::modelClass(), 'lead_activities');
|
|
}
|
|
|
|
/**
|
|
* The Person that belong to the activity.
|
|
*/
|
|
public function persons()
|
|
{
|
|
return $this->belongsToMany(PersonProxy::modelClass(), 'person_activities');
|
|
}
|
|
|
|
/**
|
|
* The leads that belong to the activity.
|
|
*/
|
|
public function products()
|
|
{
|
|
return $this->belongsToMany(ProductProxy::modelClass(), 'product_activities');
|
|
}
|
|
|
|
/**
|
|
* The Warehouse that belong to the activity.
|
|
*/
|
|
public function warehouses()
|
|
{
|
|
return $this->belongsToMany(WarehouseProxy::modelClass(), 'warehouse_activities');
|
|
}
|
|
}
|