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