Files
timebank-cc-public/app/Models/Meeting.php
Ronald Huynen 2547717edb Initial commit
2026-03-23 21:37:59 +01:00

68 lines
1.4 KiB
PHP

<?php
namespace App\Models;
use App\Models\Locations\Location;
use App\Models\Post;
use App\Traits\LocationTrait;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Meeting extends Model
{
use HasFactory, SoftDeletes;
use LocationTrait;
protected $fillable = ['post_id', 'venue', 'address', 'price', 'based_on_quantity', 'transaction_type_id', 'meetingable_id', 'meetingable_type', 'status', 'from', 'till'];
/**
* Get related post for this event
* Ont-to-one relationship
* @return void
*/
public function post()
{
return $this->belongsTo(Post::class);
}
/**
* Get the organizer of the meeting (i.e. user or organization).
*
* @return void
*/
public function meetingable()
{
return $this->morphTo();
}
/**
* Get the organizer of the meeting (i.e. user or organization).
* Accessor and alias of meetingable.
*
* @return void
*/
public function getOrganizerAttribute()
{
return $this->meetingable;
}
public function location()
{
return $this->morphOne(Location::class, 'locatable');
}
/**
* Get the transaction type for this meeting
*/
public function transactionType()
{
return $this->belongsTo(\App\Models\TransactionType::class, 'transaction_type_id');
}
}