Skip to content

Tag: php

Laravel delete() static call

I got this error: Non-static method IlluminateDatabaseEloquentModel::delete() should not be called statically, assuming $this from incompatible context Here is the code in my controller: Can someone explain what I am doing wrong and how to call it correctly? Answer You have this: But you should be doing this:

laravel errno 150 foreign key constraint is incorrectly formed

Can anybody help me to solve this problem? There are 3 tables with 2 foreign keys: Error after running migration: Answer In case of foreign keys, the referenced and referencing fields must have exactly the same data type. You create the id fields in both users and firms as signed integers. However, you create…

range Symfony form input

I’m looking for something to make this kind of input in Symfony: I don’t know which kind of input and how to deal with the Symfony controller. Here is a part of my controller but not sure it’s useful. Answer If you want to represent a start date linked to an end date, I’d advise you to…

Composer installation requirements

I am trying to install composer to the laravel project. When im doing sudo composer install in projects directory it shows me two errors: I was checking how to install it and I found these commands: composer require simplesoftwareio/simple-qrcode composer require esendex/sdk Anyway, they are giving me the sam…

Search function when one field is blank

I need to know if there’s a more efficient way to do a search when a user leaves a blank field My question is how do I do this? My own conclusion was to use a variety of and so on then corresponding each with its own SELECT * FROM…. but this seems so bothersome and not that dynamic especially

php, array_merge_recursive works well with string keys only

and the result is: so lets take a glance: the only part is the ‘b’ keys, they are actually works. I dont want to overwrite anything of it but putting them together to an array. Thats good! But then keys the other numeric keys (int or string) are screwed up. I want to have this as result: possible?…