获取当前登陆用户 id
<?php
return auth()->id()
获取当前登陆用户信息
<?php
return auth()->data()
最新会员
<?php
return \App\Plugins\User\src\Models\User::query()->orderByDesc('created_at')->take(获取数量)->get();
在 blade 中这样写循环
@foreach(\A pp\Plugins\User\src\Models\User::query()->orderByDesc('created_at')->take(获取数量)->get() as $data)
<div style="background-color:#b6b6b6">
<ul>
<li>用户名:{{$data->username}}</li>
<li>头像地址:{{super_avatar($data)}}</li>
<li>id:{{$data->id}}</li>
......
</ul>
</div>
@endforeach
获取某位用户的关注数量
<?php
return \App\Plugins\User\src\Models\UserFans::query()->where('fans_id',用户id)->count();
获取某位用户的收藏数量
<?php
return \App\Plugins\User\src\Models\UsersCollection::query()->where('user_id',用户id)->count();
获取某位用户的发帖数量
return \App\Plugins\Topic\src\Models\Topic::query()->where(['user_id'=>用户id,'status'=>'publish'])->count();
获取某位用户的草稿数量
<?php
return \App\Plugins\Topic\src\Models\Topic::query()->where(['user_id'=>用户id,'status'=>'draft'])->count();
获取某位用户的评论数量
<?php
return \App\Plugins\Comment\src\Model\TopicComment::query()->where(['user_id'=>用户id,'status'=>'publish'])->count();
获取某位用户未读通知数量
<?php
return \App\Plugins\User\src\Models\UsersNotice::query()->where(['user_id'=>用户id,'status'=>'publish'])->count();
获取某位用户未读通知
<?php
return \App\Plugins\User\src\Models\UsersNotice::query()->where(['user_id'=>用户id,'status'=>'publish'])->get();