I have the following controller:
class MyController extends Controller {
public function getTestView() {
return view("user::index");
}
}
Instead of returning the view directly from my controller method I would like to have another object which is responsible to return this view after adding some calculation code.
This is my class:
class User extends AbstractPerson {
function __construct() {
$this->initView();
}
private function initView(){
return view('user::index');
}
}
My controller now looks like this:
class MyController extends Controller {
public function getTestView() {
return new User();
}
}
After calling this I get the following error:
UnexpectedValueException in Response.php line 395: The Response content must be a string or object implementing __toString(), "object" given.
Any ideas why? Thanks
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire