I try to create a onDelete action. I have only a problem with the query My javascript and button
$("#remove_book").click(function(){
$(this).data('request-data', {
book_checked: $('.list-checkbox input[type=\'checkbox\']').listWidget('getChecked')
})
});
button
class="btn btn-danger oc-icon-trash-o"
disabled="disabled"
id="remove_book"
data-request="onDelete"
data-request-confirm="Sure ?"
data-trigger-action="enable"
data-trigger=".control-list input[type=checkbox]"
data-trigger-condition="checked"
data-request-success="$el.prop('disabled', false)"
data-stripe-load-indicator>
Delete
My onDelete function just have to delete the book what was selected. But I get the follow error: "Call to a member function delete() on a non-object" on line 43 of /www/testdomain/http/plugins/testplugin/book/controllers/Books.php
public function index_onDelete()
{
$postId = post('book_checked');
Book::whereIn('id', $postId)
->delete();
$post = book::find($postId);
$post->delete();
\Flash::success('Book Successfully deleted.');
return $this->listRefresh();
}
What means Call to a member function delete() on a non-object. The delete function is a default October function right?
Last updated