46 lines
942 B
PHP
46 lines
942 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
class ActivityType extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $table = 'activity_types';
|
|
|
|
/**
|
|
* The attributes that are mass assignable.
|
|
*
|
|
* @var array<string>
|
|
*/
|
|
protected $fillable = [
|
|
'account_id',
|
|
'label',
|
|
];
|
|
|
|
/**
|
|
* Get the account associated with the activity type.
|
|
*
|
|
* @return BelongsTo
|
|
*/
|
|
public function account(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Account::class);
|
|
}
|
|
|
|
/**
|
|
* Get the activities associated with the activity type.
|
|
*
|
|
* @return HasMany
|
|
*/
|
|
public function activities(): HasMany
|
|
{
|
|
return $this->hasMany(Activity::class, 'activity_type_id');
|
|
}
|
|
}
|