dingo / api

A RESTful API package for the Laravel and Lumen frameworks.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

use __get() images method

CrazyZard opened this issue · comments

Q A
Bug? yes
New Feature? yes
Framework Laravel
Framework version 5.8.10
Package version 2.0.0-alpha2
PHP version 7.3

Actual Behaviour

when I use __set($key) in my controller and use Dingo\Api\Routing\Helpers to return Data;
The system return me "Call to a member function collection() on null"

Code

class Controller extends BaseController
{

use Helpers;

public function __set($key)
{
if($key == 'auth_user'){
return Request::user();
}
return $key;
}

public function index(){
$list = User::all();
return $this->response->collection($list, NotifyTransformer::class);
}
}

commented

Hi

First of all, your dingo version is extremely old and needs to be updated.

Secondly, you code example doesn't have the use of the Helper class that you mentioned? I'm not really following.