回复列表
This commit is contained in:
parent
200fbdfc0a
commit
b27ddbbe7d
|
@ -11,6 +11,7 @@ namespace App\Models;
|
||||||
* @property int user_id
|
* @property int user_id
|
||||||
* @property int topic_id
|
* @property int topic_id
|
||||||
* @property User user
|
* @property User user
|
||||||
|
* @property Topic topic
|
||||||
* @package App\Models
|
* @package App\Models
|
||||||
*/
|
*/
|
||||||
class Reply extends Model
|
class Reply extends Model
|
||||||
|
|
|
@ -15,7 +15,7 @@ use League\Fractal\TransformerAbstract;
|
||||||
|
|
||||||
class ReplyTransformer extends TransformerAbstract
|
class ReplyTransformer extends TransformerAbstract
|
||||||
{
|
{
|
||||||
protected $availableIncludes = ['user'];
|
protected $availableIncludes = ['user', 'topic'];
|
||||||
|
|
||||||
public function transform(Reply $reply)
|
public function transform(Reply $reply)
|
||||||
{
|
{
|
||||||
|
@ -29,6 +29,11 @@ class ReplyTransformer extends TransformerAbstract
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function includeTopic(Reply $reply)
|
||||||
|
{
|
||||||
|
return $this->item($reply->topic, new TopicTransformer());
|
||||||
|
}
|
||||||
|
|
||||||
public function includeUser(Reply $reply)
|
public function includeUser(Reply $reply)
|
||||||
{
|
{
|
||||||
return $this->item($reply->user, new UserTransformer());
|
return $this->item($reply->user, new UserTransformer());
|
||||||
|
|
Loading…
Reference in New Issue
Block a user