12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- <?php
- namespace App\Models\Fpdx;
- use App\Models\Model;
- /**
- * App\Models\Fpdx\RoomThumbModel
- *
- * @property int $id 主键
- * @property \Illuminate\Support\Carbon $created_at 创建时间
- * @property \Illuminate\Support\Carbon $updated_at 更新时间
- * @property int $uid 用户
- * @property int $room_id 房间id
- * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Fpdx\RoomThumbModel newModelQuery()
- * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Fpdx\RoomThumbModel newQuery()
- * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Fpdx\RoomThumbModel query()
- * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Fpdx\RoomThumbModel whereCreatedAt($value)
- * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Fpdx\RoomThumbModel whereId($value)
- * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Fpdx\RoomThumbModel whereRoomId($value)
- * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Fpdx\RoomThumbModel whereUid($value)
- * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Fpdx\RoomThumbModel whereUpdatedAt($value)
- * @mixin \Eloquent
- */
- class RoomThumbModel extends Model
- {
- public $table = "kdgx_fpdx_room_thumbs";
- public $dateFormat = 'U';
- protected $fillable = ['id', 'uid', 'room_id'];
- /**
- * 是否点赞
- * @param int $room_id
- * @param int $uid
- * @return bool
- */
- public function isThumb(int $room_id, int $uid)
- {
- $rt = RoomThumbModel::where([
- ['uid', $uid],
- ['room_id', $room_id]
- ])->first();
- if (collect($rt)->isEmpty()) {
- return false;
- } else {
- return true;
- }
- }
- }
|