Category "laravel"

How in Laravel run JavaScript code stored in php variable?

In the livewire component, I have the script tag: <script> {!! $script !!} </script> Let's say the $script variable contains console.log('test'); I

Why do I have invalid argument supply for foreach in Laravel for json response? [duplicate]

I am working on Razorpay integration and after succesful payment when I try to save the details to the database I get an error. I am sending t

How to convert a carbon into string, to take the date only?

i have an collection like this 0 => array:4 [ "so" => "SO-1" "product_name" => "EXTREME FORTE - BP" "created_at" => Carbon @1527481346 {#628

Laravel SQL query midnight time not showing

I am making a schedule display system and it shows the schedules of ferries. my problem is if I dont put midnight time in order then query skips midnight time a

Copy to clipboard code in JavaScript doesn't work

I'm trying to write in javascript and I want to understand why it doesn't work? sample order code that I want to copy: 593004485164756431 when I copy to clipboa

PHP using str_starts_with for array to exclude same as with wildcard

This is my ignore list which i have some item that i don't into that $ignoreRoutes = [ 'administrator', 'attachImage', 'login', 'logout', 'l

Laravel: Schedule a job or an artisan command?

I have a Product model with id,name,price. The price value is stored in an external API and i need to fetch it every minute in order to update it in the databas

Laravel component constructor method is only working in local environment

My component looks like this: namespace App\View\Components; use Illuminate\View\Component; use App\Http\Controllers; use Illuminate\Http\Request; class shop

Laravel 5.5 file_put_contents permissions issue

I have a new Laravel project, with Passport and basic authentication installed, and I am getting this error when I try to call the built in /api/register endpo

[laravel][npm] I can't use swiper error Uncaught TypeError: Swiper is not a constructor

Today I try swiper but not working. I install Swiper with npm npm install swiper this is my code index.blade.php <div class="swiper-container">

Laravel unique validation on multiple columns

I have 2 columns in table servers. I have columns ip and hostname. I have validation: 'data.ip' => ['required', 'unique:servers,ip,'.$this->id] This

How to have laravel pagination links using the bootstrap 4 default pagination styles?

I'm using laravel default pagination with: {{$posts->links()}} and the pagination works, the links appear and

What's the difference between `retry_after` and `timeout` options for Laravel queues?

I came across an issue in my code base where a job was being terminated early while its timeout was set to 540 seconds. However after looking in the documentati

Detect Laravel fortify login and do something

I'm using Fortify in my Laravel 8 application that's used as an API backend to a Nuxt front-end. When a user logs in, and their log in is successful; I'd like t

Using spatie(laravel-permission) in Laravel 8

When Assigning permission for a role using seeder, in permissions table it will take guard_name as "web", but when adding permission through CRUD, it will take

Laravel mongodb where array field contains value

I use mongodb and mysql together with Laravel. Fields table in mysql database can have more options in mysql database. fields table in mysql: id, name options

Check if user online laravel

I have column last_activity, where write date last activity user with middleware. How I can check online user and when he logout? Middleware: class LastActivi

How to order by eager loaded relationship in Laravel 5.5?

The code below works perfectly and displays all products with discounts in JSON Format for my API. But I want the result ordered by id in the discounts table. S

Change Laravel Fortify Auth Column Names

I tried following these steps to no avail https://stackoverflow.com/a/64299968/7309037 I have a User Table with the column name "EmailAddress" but Laravel is lo

Laravel Inertia Shared Data not updating

I have a laravel breeze app up and running using InertiaJS scaffolding. I'm using a middleware to pass general data to the layout. The issue is the following :