feat : user
This commit is contained in:
47
app/Model/UserInvite.php
Normal file
47
app/Model/UserInvite.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user