48 lines
1.1 KiB
PHP
48 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Model;
|
|
|
|
use Hyperf\DbConnection\Model\Model;
|
|
|
|
/**
|
|
* @property int $id
|
|
* @property int $user_id
|
|
* @property int $invitee_user_id
|
|
* @property int $status
|
|
* @property int $channel
|
|
* @property string $create_time
|
|
* @property string $update_time
|
|
*/
|
|
class UserInvite extends Model
|
|
{
|
|
/**
|
|
* The table associated with the model.
|
|
*/
|
|
protected ?string $table = 'user_invite';
|
|
|
|
/**
|
|
* The attributes that are mass assignable.
|
|
*/
|
|
protected array $fillable = [];
|
|
protected array $guarded = [];
|
|
|
|
/**
|
|
* The attributes that should be cast to native types.
|
|
*/
|
|
protected array $casts = ['id' => 'integer', 'user_id' => 'integer', 'invitee_user_id' => 'integer', 'status' => 'integer', 'channel' => 'integer'];
|
|
|
|
const string CREATED_AT = 'create_time';
|
|
const string UPDATED_AT = 'update_time';
|
|
|
|
/**
|
|
* @param int $userId
|
|
* @return int
|
|
*/
|
|
public function checkIsInvite(int $userId): int
|
|
{
|
|
return $this->where('user_id',$userId)->count() ?? 0;
|
|
}
|
|
}
|