Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete Item Problem #178

Closed
ahmadronaghdev opened this issue Oct 13, 2016 · 8 comments
Closed

Delete Item Problem #178

ahmadronaghdev opened this issue Oct 13, 2016 · 8 comments

Comments

@ahmadronaghdev
Copy link

when delete button clicked in row show this message:

There's been an error. Your item might not have been deleted.

screen shot 1395-07-22 at 15 35 47

how can i fix this ?

@tabacitu
Copy link
Member

Hi @A-Ronagh ,

This is odd. I've just checked the package and the delete functionality works, it throws me a green success message. You should open your network tab in Developer Tools to debug the problem - see what the ajax response is for that delete call - it should say the actual error.

If you've overwritten the destroy() method in your EntityCrudController that might be the culprit.

Cheers!

@ahmadronaghdev
Copy link
Author

tnx for answer
in Network Tab request return 405 Method Not Allowed

screen shot 1395-07-22 at 20 12 27

@tabacitu
Copy link
Member

Have you used CRUD::resource() in your routes file? Can I see it?

@ahmadronaghdev
Copy link
Author

yes I Use CRUD::resource()

Route::group(['prefix' => 'adminpanel', 'middleware' => 'admin'], function()
{
// Route::get('dashboard', 'Admin\AdminController@index');
Route::get('config', 'Admin\AppConfigController@showEditForm');
Route::post('config/addCoin', 'Admin\AppConfigController@addCoin');
Route::post('config/addMessage', 'Admin\AppConfigController@addMessage');
Route::post('config/updateAppConfig', 'Admin\AppConfigController@updateAppConfig');
// [...] other routes

// Dick CRUD: Define the resources for the entities you want to CRUD.

// CRUD::resource('app-config', 'Admin\AppConfigCrudController');
CRUD::resource('app-user', 'Admin\AppUserCrudController');
CRUD::resource('channel-list', 'Admin\ChannelListCrudController');
CRUD::resource('channel-reported-list', 'Admin\ChannelReportedListCrudController');
CRUD::resource('channel-user-list', 'Admin\ChannelUserListCrudController');
CRUD::resource('price-list', 'Admin\PriceListCrudController');
CRUD::resource('question-list', 'Admin\QuestionListCrudController');
CRUD::resource('request-list', 'Admin\RequestListCrudController');
CRUD::resource('user-payment', 'Admin\UserPaymentCrudController');
});

screen shot 1395-07-22 at 21 38 03

@tabacitu
Copy link
Member

Does a composer update fix it?

@ahmadronaghdev
Copy link
Author

I check this tnx for answer :)

@nhuebnereagle
Copy link

nhuebnereagle commented Aug 12, 2017

I ran into this due to nesting my CRUD models, so I had to add the following functions (edit and destroy) because the $id was returning as null.

Nested being:

Course -> Course Chapters -> Course Chapter Pages

This is from my Course Chapter Pages controller, where the general CRUD was not picking up the "last" ID in the chain of nested CRUDs.

You will need to do a dd($this) in the edit and destroy to make sure you pull back the right ID to pass to the parent. I hope this helps someone with my issue.

    public function edit($id)
    {
        return parent::edit($this->page);
    }

    public function destroy($id)
    {
        return parent::destroy($this->page);
    }

@MilitaruC
Copy link

MilitaruC commented Dec 18, 2017

Yea... deleting is a problem. I had to add a route before the MyCrudController route resouce:
Route::post('/myroute/{id}/delete', 'MyCrudController@destroy');
And I edited the delete button link by adding /delete at the end.

This was referenced Apr 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants