mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-05-07 03:29:54 -05:00
83 lines
2.7 KiB
PHP
83 lines
2.7 KiB
PHP
<?php
|
|
/**
|
|
* NOTICE OF LICENSE.
|
|
*
|
|
* UNIT3D Community Edition is open-sourced software licensed under the GNU Affero General Public License v3.0
|
|
* The details is bundled with this project in the file LICENSE.txt.
|
|
*
|
|
* @project UNIT3D Community Edition
|
|
*
|
|
* @author HDVinnie <hdinnovations@protonmail.com>
|
|
* @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0
|
|
*/
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use App\Traits\Auditable;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
/**
|
|
* App\Models\Subscription.
|
|
*
|
|
* @property int $id
|
|
* @property int $user_id
|
|
* @property int|null $forum_id
|
|
* @property int|null $topic_id
|
|
* @property \Illuminate\Support\Carbon|null $created_at
|
|
* @property \Illuminate\Support\Carbon|null $updated_at
|
|
* @property-read \App\Models\Forum|null $forum
|
|
* @property-read \App\Models\Topic|null $topic
|
|
* @property-read \App\Models\User $user
|
|
*
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Subscription newModelQuery()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Subscription newQuery()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Subscription query()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Subscription whereCreatedAt($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Subscription whereForumId($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Subscription whereId($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Subscription whereTopicId($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Subscription whereUpdatedAt($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Subscription whereUserId($value)
|
|
* @mixin \Eloquent
|
|
*/
|
|
class Subscription extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
use Auditable;
|
|
|
|
/**
|
|
* Belongs To A User.
|
|
*
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
*/
|
|
public function user()
|
|
{
|
|
return $this->belongsTo(User::class)->withDefault([
|
|
'username' => 'System',
|
|
'id' => '1',
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* Belongs To A Topic.
|
|
*
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
*/
|
|
public function topic()
|
|
{
|
|
return $this->belongsTo(Topic::class);
|
|
}
|
|
|
|
/**
|
|
* Belongs To A Forum.
|
|
*
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
*/
|
|
public function forum()
|
|
{
|
|
return $this->belongsTo(Forum::class);
|
|
}
|
|
}
|