Я использую отношение, чтобы показать сбор данных с моделью ....
public function index($id){
$user = User::with('files.comment',
'files.likes','files.dislike')->get()->find($id);
// return response()->json(['data' => $user], 200,[],JSON_NUMERIC_CHECK);
//while using return response i am getting all my data bt using whrn trait showall method it gives arguments pass error
return $this->showall($user);
}
моя черта apiresponse
protected function showall(Collection $collection, $code = 200){
if ($collection ->isEmpty()) {
return $this->successResponse(['data'->$collection],$code);
}
$transformer = $collection->first()->transformer;
$collection = $this->sortData($collection, $transformer);
$collection = $this->transformData($collection, $transformer);
return $this->successResponse( $collection,$code);
}
как это исправитьпожалуйста, дайте мне знать ...