Skip to content
Advertisement

Tag: laravel

How to execute an IF url or route contains … function with LARAVEL 5

I use Laravel 5 for one of my projets and after hours spend I’m asking for little help!! I need to execute a Script (Google Gtag) if the user is on this exact url : or/and comes from: I tried this without succes: Does someone can help me ? Answer You can use str_contains() for this purpose.The str_contains() function checks

PDOException: SQLSTATE[22007]: 1292 Incorrect datetime value on UTC ISO-8601

Hello I’m getting the following error PDOException: SQLSTATE[22007]: 1292 Incorrect datetime value ‘2022-03-07T18:08:12.000000Z’ for column ‘created_timestamp’ at row 1 in /[path]/[to]/[project]/vendor/laravel/framework.src.Illuminate/Database/Connection.php:496 That looks like a valid UTC ISO-8601 date format to me. And in the following code The var dump prints a carbon instance. The docs say: When a column is cast as a date, you may set the corresponding

laravel8 sanctum “Unauthenticated” when access any route under “auth:sanctum” middleware in server

I’m using sanctum for api, and all api run fine in localhost, but when run api in live server token doesn’t work, any route under “auth:sanctum” middleware redirect me to “Unauthenticated”, although i loged in, it loged in successfully and generate token, I passed “token” of the user in postman header, although it works fine in localhost, I tried alot

Problem with migrating sql function in phpmyadmin in Laravel

I have sql function that I need to migrate to phpmyadmin in order for my code to work. I make migration where I insert code for sql function and then I do php artisan migrate:fresh –seed it successfully completes and fills all table and it shows that migration worked. But when I go in phpmyadmin it didn’t create function. I

Laravel Carbon change date to specific data

How to change f.e. only month and day in existing date variable(object ?)? I’ve got date type fields in db: And then I want in blade view change according to special conditions. Above code changes the date to something like “1970-01-01”. The year could stay as it is stored in current variable, but I need to know how change only

How to run migrations even if the table already exist?

I ran php artisan migrate:fresh to delete every table, then I have a sql dump file that also creates the tables and populates them with some data. However then I also need to run php artisan migrate since there are some migrations that are needed to add some extra columns to some tables (and these columns are not in the

What causes this query builder error in my Laravel 8 app? [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers. Closed 6 months ago. Improve this question

PHP laravel Flash message is not showing

I am redirected to the desired page but success message is supposed to be shown there but there is no message has been shown. I have tried multiple methods online but there is something I missing. Controller File: Blade File: Answer Try this or there is another method called with() you can use it after redirect()

Advertisement