mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-04-21 09:20:08 -05:00
71 lines
2.3 KiB
PHP
71 lines
2.3 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 App\Traits\Auditable;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
/**
|
|
* App\Models\Like.
|
|
*
|
|
* @property int $id
|
|
* @property int $user_id
|
|
* @property int $post_id
|
|
* @property int|null $like
|
|
* @property int|null $dislike
|
|
* @property \Illuminate\Support\Carbon|null $created_at
|
|
* @property \Illuminate\Support\Carbon|null $updated_at
|
|
* @property-read \App\Models\Post $post
|
|
* @property-read \App\Models\User $user
|
|
*
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Like newModelQuery()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Like newQuery()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Like query()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Like whereCreatedAt($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Like whereDislike($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Like whereId($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Like whereLike($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Like wherePostId($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Like whereUpdatedAt($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Like whereUserId($value)
|
|
* @mixin \Eloquent
|
|
*/
|
|
class Like extends Model
|
|
{
|
|
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 Post.
|
|
*
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
*/
|
|
public function post()
|
|
{
|
|
return $this->belongsTo(Post::class);
|
|
}
|
|
}
|