Closed lbm-services closed 7 years ago
I solved it like this:
public function togglePublished($entity)
{
$id = \Request()->query('id');
Models\blog_posts::updatePublished($id);
return redirect('panel/blog_posts/all');
}
But why is the entity passed as an argument, if the controller is for a defined entity, it could be a private property as well, I think.
@lbm-services thank you for your solution, if you think we need to change the code please send a pull request
Hi, I wanted to add a toggle-publish-link in my grid view. I added this to my template:
and added a togglePublish-method to my controller.
Now I get
Type error: Argument 1 passed to blog\Http\Controllers\blog_postsController::togglePublished() must be an instance of Illuminate\Http\Request, string given
Somehow all crudcontroller methods get the entity name as an argument and nothing else. How can I get the row id from query string?