Skip to content
Advertisement

Tag: laravel

Laravel: method parameter bypass

In my laravel (7.x) application, I have a method called _index in different controllers & models with exactly same functionality (fetch the data to display in the grid) and parameters (except 1, that requires an additional parameter called available). So, I created a super method in the base controller, something line this: Controller.php SomeController.php AnotherController.php Only SomeController / index is

Keeping array reference and adding something into that

In my very simple Laravel livewire component i have an array and when i try to add another data into that by clicking on a simple for example div i get fresh array with the last inserted data into that and i cant keep this array reference to append something data into that thanks in advance Answer If you’re looking

how to make Carbon null in laravel?

I’m making a table in Laravel and I want my “besttime” to be a nullable but it’s returning the current time if I keep it empty. (I’m using carbon because I want the H:i format without the seconds) here’s what my input looks like Answer I will suggest you to add mutators in model so you can keep code simpler

SQLSTATE[HY000]: General error: 1005 Can’t create table `school`.`posts` (errno: 150 “Foreign key constraint is incorrectly formed”)

before everything, I tried hard many websites and forums to solve this problem until these posts related to this problem in StackOverflow, but I can’t solve the problem. I want to create to one to many relationship between Post and Category model but I get that error code. SQLSTATE[HY000]: General error: 1005 Can’t create table school.posts (errno: 150 “Foreign key

Advertisement