InfyOmLabs / adminlte-generator

Boilerplate of Laravel with InfyOm Laravel Generator for AdminLTE Templates
https://infyom.com/open-source/laravelgenerator/docs/8.0/boilerplates
387 stars 272 forks source link

Call to undefined method withoutEvents() #56

Closed shubham1397 closed 4 years ago

shubham1397 commented 4 years ago

getting this error while inserting and updating data from the admin section as well as from API

mitulgolakiya commented 4 years ago

@shubham1397 what laravel version you are using?

shubham1397 commented 4 years ago

6

vishalinfyom commented 4 years ago

@shubham1397 will you please share the exact laravel version e.g 6.0.1 and which command you have run to generate scaffold, better to have your db schema so we can identify exact problem.

shubham1397 commented 4 years ago

hey sorry, I,m using laravel 5.7.15, whenever I am going to add new data from the admin dashboard, it gives me an error -

BadMethodCallException Call to undefined method App\Models\drink::withoutEvents()

this is my table schema

image

vishalinfyom commented 4 years ago

@shubham1397 i have tested with your laravel version and your DB schema and its working fine. may be you are making some mistake while generating scaffold.

Please verify you are following this steps : https://labs.infyom.com/laravelgenerator/docs/5.7/installation

shubham1397 commented 4 years ago

yeah sure

davepartner commented 3 years ago

I suddenly started facing this same issue on all my update() methods that makes use of the repository. This line for instance, causes the above error $payment = $this->paymentRepository->update($input,$payment->id); It happens on all models, not just one.

Edit: to fix it (albeit temporarily) I created an empty withoutEvents() function in the model specified in the error.

Eg. I went into Payment.php and added a function like so:

public function withoutEvents(){

}