This is my initial migration Now, the easy time ended and now I have to move name and phone to customer table. This is my create customer migration. I don’t know where to do this operation so I just throw all in the migration. And alter order migration Now I’m stuck with empty customer_id. I have no clue what to
Tag: laravel
Error 401 after successful login to Laravel using jwt
In my Laravel project, I use jwt for user authentication.I successfully login and receive the token. I send the token with the Barear prefix in the header but I get a 401 error.Meanwhile, my project works well on localhost, but it has this problem on cpanel hosts.My codes are below in config/auth.php and in configjwt.php ]; my web route: my
Eloquent Relationships hasMany use loop
I have a database with multiple address records of a user. When I do “pluck()” and “join()” in the foreach path, I get results. But when I type $user->getAddress->address in structures like hasOne, I get the result I want. In short, can I return the loop in hasMany more practically? Following my code: user Table adress Table UserModel Controller Answer
Postgres, get all items from one table which ids are not in another tables JSON array column?
I have two tables: cars table which contains: electric_cars How to select all records from the cars table which are not in the non_valid_cars array of ids in the electric_cars column with id cars_id? Also, I am using Laravel Framework, but I will translate a query into the framework. Thank you so much for your help. Answer You can use
Return custom array in json model with Lumen
With Lumen 8 I have : Model : Store Controller : StoreController Repository : StoreRepository I can get my Store without any problem and get the json below : I would like to get open/close time of the Store. In my model I have a array (for test) and I can show it like that : And get this result
Foreach does not return all values
I have a foreach but it only returns the last value and not all the values, what is the problem? my array My code: Currently it only returns the last value I need you to return the following (example) If it is not clear I will try to improve it Answer If we consider your data won’t change, and you
How to output array with new line separated values using Laravel Storage:put
How to output an each array element in a new line with Laravel Storage:put? I have an array like below that I want to put into a file, array_test.txt, where each element goes on a new line. Using Laravel’s Storage, it goes like Storage:put($fileName, $arrTest); However the output is on a single line. Storage as an $options tag, but that
IlluminateDatabaseQueryException SQLSTATE[HY000] [2002] No such file or directory but migrations works [closed]
Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 months ago. Improve this question first time I ask via the web, but I don’t know what I can do anymore. My question is about
images not appear in the blade page if send it to email by using queue job Laravel?
I send an email to user for verifying, by using queue job after registration, the job run successfully but the (blade page), which sent to the user doesn’t show the images, Although if I sent the blade page without send it by queue job, the images appear fine!? So the issue is that: the images in the blade page in
Laravel 8 – Listen to eloquent events made during a specific request
Currently, I’m trying to wire a telemetry library (OpenTelemetry php lib) to the Laravel event model. The idea is to forward traces to a third party service. A single trace consistents of a request and all database calls that have been made during the request. I’ve created three middleware components: BeforeRequest: starts a trace OnRequest: call event listener which listened