513 questions
3
votes
1
answer
39
views
Laravel Livewire/Eloquent: Position update fails when moving task to first position (index 1) of a different list
My application uses Laravel Livewire with Alpine.js/SortableJS for drag-and-drop reordering of tasks between status columns. The tasks have a status (string) and a position (integer) in the database.
...
0
votes
1
answer
103
views
Laravel migration creates wrong columns and data mismatch in employers table
I’m building a job board project in Laravel, and I’m trying to establish a one-to-one relationship between User and Employer. However, my database table is not being generated correctly — the columns ...
0
votes
0
answers
59
views
How to prevent Stripe customer balance (credits) from being used during subscription creation or update in Laravel or Stripe API?
I’m working with Stripe subscriptions and customer balances (credits).
By default, when a customer has credits in Stripe, Stripe automatically applies those credits toward the next invoice or ...
0
votes
1
answer
94
views
Switching from registering Service Providers in configuration to providers.php when upgrading to Laravel 11
I have a Laravel application originally developed in Laravel 10, but I have since upgraded the application to Laravel 12. One of the changes starting in Laravel 11 is that custom service providers are ...
0
votes
0
answers
61
views
How does Eloquent's new Laravel 11 HasScopedValues feature address it and how is it different from casts?
In Laravel 11, Eloquent introduced HasScopedValues to define scoped values for model attributes somewhat like $casts. I’m unclear how it differs from $casts can it transform values like casts or is it ...
2
votes
0
answers
59
views
Migrations & Seeders & Command for production data [duplicate]
Recently after some research I came up with a question: how to handle default / initial data population in a Laravel project which goes live: should it go into seeders or migrations? I've seen two ...
3
votes
0
answers
265
views
How to retain session after redirect in Laravel
I'm using Laravel's database notifications. When a user clicks on a notification, it first redirects to a controller that sets some session data, then redirects again to the final URL.
However, on the ...
0
votes
0
answers
68
views
getting unauthenticated error in phonepe refund api
i am getting problem of getting unauthenticated in the phonepe refund api. also i am using that token in the payment time it's working fine.
$data = $this->getAuthKey();
$payment = Payment::...
1
vote
1
answer
82
views
Attribute Accessors not working after laravel app upgrade
Laravel accessor not working after I upgraded from v8.75 to v11.31
I had this LARAVEL v8.75 App where in the User model I created an Accessor for photo like below
public function getPhotoAttribute($...
0
votes
1
answer
180
views
Laravel 11 Events Firing Multiple Times in Production (Nginx, Azure App Services, PHP 8.3)
I'm encountering an issue where Laravel events are firing multiple times, but only in the production environment.
Environment:
Laravel: 11.x
PHP: 8.3
Web Server: Nginx
Hosting: Azure App Services
...
-1
votes
1
answer
801
views
When creating a Laravel project, is the kernel.php in the http and console folders already there? Why isn't it there in mine?
i have created a middleware
public function handle(Request $request, Closure $next)
{
if (!auth()->check() || auth()->user()->role !== 'admin') {
abort(403, '...
0
votes
0
answers
37
views
Livewire /upload-file not triggered when selecting a file
I have a Livewire Component Import.php:
<?php
namespace Modules\Donor\app\Livewire\Modals;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Notification;
use Illuminate\Support\...
1
vote
2
answers
99
views
Admin middleware does not work properly in Laravel
I have made a middleware for admin routes
public function handle(Request $request, Closure $next)
{
if (!auth()->check() || !auth()->user()->is_admin) {
abort(401);
}
...
0
votes
4
answers
278
views
Rounding floats / decimals in e-commerce (PHP 8.3 and Laravel 11)
So due to the fact that product quantities are not limited to integers but can store decimals up to 4 digits, I can have a product with quantity of 69.4160 square meters of something.
Now assuming the ...
0
votes
1
answer
44
views
Laravel Scheduler Not Running Even Though It’s Configured in EC2
I have a Laravel scheduler configured to run every 6 hours. Based on the schedule, it should have already executed, but I don’t see any expected results or changes from it.
I also added a logger() ...
0
votes
0
answers
38
views
My laravel project implemention the socialite package, but fetche the error
public function handleGoogleCallback(Request $request)
{
$user = Socialite::driver('google')->user();
$findUser = User::where('google_id', $user->id)->first();
if ...
0
votes
0
answers
75
views
Laravel + Vue.js Error: "Module not found: Error: Can't resolve './vue/app'"
I am using laravel 11 with Vite.config.
I am trying to add Vue.js to my project.
The instructions say that I must do this in my app.js
import "./bootstrap";
import { createApp } from "...
1
vote
2
answers
389
views
Laravel 11 + Backblaze B2 (S3-Compatible): PUT error — "Unsupported header 'x-amz-checksum-crc32'" when uploading files
I'm using Laravel's filesystem with the S3 driver to connect to Backblaze B2's S3-compatible API. Here's my disk configuration in config/filesystems.php:
'disks' => [
'b2' => [
'...
0
votes
0
answers
33
views
laravel-debuger does not show a few tabs in laravel 11
I have made a upgrade from laravel 10 to laravel 11 but suddenly the laravel-debugger does not show all the tabs.
To solve the problem I deleted the vendor map and composer.lock file and ran composer ...
0
votes
0
answers
20
views
How to encrypt and decrypt a file using gpg command using assymetric key? [duplicate]
For my laravel application, I need the gpg command to do encryption and decryption of CSV file using asymmetric key.
In my laravel application, I am already using symmetric key encryption and ...
0
votes
0
answers
108
views
Pusher is not a constructor after npm run build with Vite, Laravel Echo, and Pusher-js
I'm using Vite, Laravel Echo, and Pusher-js in my Laravel + Vue 3 project. My setup works perfectly in development with npm run dev, but after running npm run build, I get the following error in the ...
0
votes
0
answers
41
views
Laravel view not syncing with database pivot
I recently started a small excercise (I've been learning web developing since 5 months and just started a PHP Laravel course) creating a potential e-commerce and was tweaking the cart section.
The ...
0
votes
4
answers
169
views
Livewire 3.6.10 with Laravel 11: wire:model not binding input value after page refresh
I'm working with Laravel 11, Livewire 3.6.10, and Alpine.js (properly configured). I'm encountering an issue where wire:model doesn't bind the value to an input field after a page refresh, even though ...
0
votes
0
answers
44
views
Issue in Excel Export in Laravel 11 it caches results
I am using maatwebsite/excel Export In Laravel 11.0 but I am facing an issue it is ignore any changes I made in the controller or in the export class
here is my export class code:
namespace App\...
1
vote
1
answer
176
views
Laravel Scramble generate docs for https routes not working
I have Laravel 11.x app developing on Github Codespaces. I am trying to generate the documentation using Scramble package.
Github Codespaces publish urls are using https.
I am using api_domain entry ...
3
votes
2
answers
255
views
Laravel Disk b2 (backblaze) not working in Laravel 11
This is my config/filesystems.php:
'b2' => [
'driver' => 's3',
'key' => '*************',
'secret' => '**************',
'region' => 'us-west-002',
...
1
vote
1
answer
54
views
Importing node_modules from a dedicated Node.js project
I am currently Using Laravel 10 (I know it's outdated and I will upgrade asap), and I have node_modules folder inside the project because i installed some npm modules that I need.
But I need to move ...
0
votes
0
answers
196
views
Intervention Image and Laravel 11
I am having a problem with intervention image and Laravel 11. I am upgrading a program which is fine with Laravel 10.
I installed with
composer require intervention/image-laravel
and then ran
php ...
0
votes
1
answer
78
views
Laravel Dependency Injection running before Middleware
I was under the impression that middleware runs BEFORE the route functions it wraps around.
Route::middleware([MyMiddleware::class])->group(function() {
// routess
});
But if one of the routes ...
0
votes
1
answer
23
views
CC and BCC give Cannot access offset of type string on string in
When I try to send an email with CC, BCC, or both CC and BCC, I get the following error: "Cannot access offset of type string on string." If I send the email without CC or BCC, there is no ...
1
vote
1
answer
275
views
Issue after Upgrading to Laravel 11: Undefined array key “driver”
I followed all the upgrade guide requirements, but when I run php artisan, I get the following error:
Undefined array key "driver"
at vendor/laravel/framework/src/Illuminate/Filesystem/...
0
votes
0
answers
34
views
Auth::user() Returns null Even with Valid Token (Laravel Sanctum)
I'm working on a Laravel 11 API using Sanctum for authentication. I have a route protected by the auth:sanctum middleware, and I'm sending a valid token in the request header. However, when I try to ...
0
votes
1
answer
173
views
Laravel 11 - how to call the old 'Handler.php' class from app.php - withExceptions
I have recently created a new project in Laravel 11 and can not get my custom error handling class to work. I have a class I use throughout all my Larvael projects (laravel 10). I want to use this ...
0
votes
1
answer
82
views
Larastan v2 - wrong return type using find
I have a method that performs a find() and return the model, like this:
function getRecord(string $id): MyModel
{
return MyModel::query()->findOrFail($id);
}
With this code I get the following ...
0
votes
0
answers
79
views
Crawling a page in Laravel 11 with spatie browsershot works from command but not directly from url in server
I have set a crawling command that works in local as well as in live using Laravel 11 and spatie browsershot. But when running directly from a url and cron in server following error occurs. I am using ...
1
vote
1
answer
75
views
Model Observer issue in nested transaction update of model
class ExampleUserService
{
public function approve($user, $data)
{
$approvedUser = DB::transaction(function () use ($user, $data) {
if ($data['approve_by_admin'] == 1) {
...
0
votes
0
answers
46
views
Log messages to file present tenant's directory when using tenancy for laravel (Stancl/tenancy)
I am using Tenancy for Laravel (Stancl/Tenancy), Laravel 11, package. Everything working well. I want to know how to supply name of channel as a variable to log messages in the tenant's folder using ...
0
votes
0
answers
40
views
selecting a city doesn't populate the area dropdown in my subarea form in Laravel 11
I have created City, Area, Subarea Crud in Laravel 11.
where city and area are simple are working correctly but the subarea blade in the add form when the city is selected then why respected areas to ...
1
vote
0
answers
57
views
How do I make traits share conflicting methods and properties in PHP
I have this trait
HasExtendedRoles.php
trait HasExtendedRoles
{
use HasRoles;
use HasExtendedPermissions {
HasExtendedPermissions::getPermissionClass insteadof HasRoles;
...
1
vote
2
answers
213
views
Laravel pagination not displayed or not working
I'm trying to use pagination but when I check it, it doesn't show up in the UI. I've searched and tried many solutions but still no luck. is there something missing or wrong in my code?
Blade
<div ...
1
vote
0
answers
70
views
Laravel seeder only inserting one record; should insert 2500
I have a Laravel seeder that is only inserting one record when I have a factory and the seeder should insert 2500 records.
Factory:
public function definition(): array
{
$timestamp = $...
0
votes
0
answers
22
views
EBUSY error on npm run watch (Laravel Vite) when modifying SCSS – Need to restart manually
Issue
I'm facing an issue where npm run watch (Laravel Vite) crashes every time I modify and save an SCSS file. The error message shows that a file is locked (EBUSY error), forcing me to manually ...
0
votes
0
answers
67
views
Inertia Js , React Problem To Handle Laravel Returned Errors
ok, I've been using inertiaJs for a little over 1 year, only it's as if
inertia can no longer receive data from the backend.
for example, here's the simple authentification form I send:
const ...
1
vote
0
answers
74
views
Laravel 11 WS only event handling and listeners
I am trying to build a multiplayer game using only WebSockets for the chat and the game moves.
My version is laravel 11, I started this before v12 came out. I am also using Laravel Reverb for the ...
0
votes
0
answers
111
views
Struggling to print using thermal printer via laravel
I'm using an XP-246B thermal printer. I have shared the printer and ensured that its name doesn't contain any whitespace. Also, I ran a test through Windows built in test page, and it was successful.
...
-1
votes
1
answer
151
views
My Laravel localhost doesn't work correctly, but php artisan serve works
Laravel route returns 404 when accessing via localhost, but works with php artisan serve
I downloaded Laravel and wrote some routes and views. Then, I used XAMPP to start Apache and MySQL. After that, ...
1
vote
0
answers
18
views
Laravel route returning "No response data for this request" when accessing an image file
I'm working on a Laravel application where I need to serve images stored in the filesystem and display them on a web page. I have defined the following route in web.php:
Route::post('/image/{campaign}/...
-1
votes
3
answers
158
views
laravel 11 : resource route doesn't work the same way when it's detailed in some route lines
laravel 11 here
in web.php
Route::resource('event', EventController::class);
works ok
when i replace this line by
Route::get('/event', [EventController::class, 'index'])->name('event.index');
...
0
votes
1
answer
101
views
Multilingualism in Laravel 11
I am working on multilingualism using the mcamara library
This is what I did:
In the laravellocalization.php file
I activated the Arabic and English languages
In the boostrab/app.php file, I added the ...
2
votes
1
answer
137
views
Using Middleware and Prefix or any other parameter simultaneously in Route Groups
What I need is to use prefix() with Middleware simultaneously within Laravel.
For example this code:
Route::prefix('admin')->group(function () {
Route::get('/users', function () {
// ...