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:
Tag: php
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…
Getting Controller does not exist after moving my controller to sub folder in laravel 5
I have created a resource full route which was pointing to a CRUD controller in App/Http/Controller/SeatController.php my Route in api.php Route::resource(‘websites’, ‘SeatController’); I wanted to put all controllers related to Seat inside a directory. I created a directory named Seat…
laravel Could not open input file: artisan (5.3)
I’m new to Laravel ad i have just created new project using official laravel documentation. After installing when i run php artisan migrate it will showing Could not open input file: artisan error in console Listing of commands that i run composer create-project –prefer-dist laravel/laravel larave…
Compare two arrays and create an associative array of true/false values
I want to compare the values of two flat, indexed arrays and generate a new array where the keys are the original values from the first array and the values are boolean values indicating whether the same value occurred in both origibal arrays. I tried to compare the arrays with the array_diff() function but i…
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…
Modify uploaded file name with Codeigniter – String manipulation
I upload image files with codeigniter to my website using: and getting the filename in this way: I want to change this filename adding “_thumb” before extension and after the name. Like ‘sda8sda8fa8f9.jpg’ to ‘sda8sda8fa8f9_thumb.jpg’. Since I need to keep hashed name, what…
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?…