87 questions
5
votes
1
answer
169
views
Set SQL Server LoginTimeout in Laravel
I've encountered a problem in my Laravel 12 project. I usually save my data in a remote SQL Server database, but I have to consider the case of a db server malfunction. I have a backup local ...
3
votes
2
answers
7k
views
How to correctly configure CORS in Laravel 12.13 with the HandleCors middleware in bootstrap/app.php?
I am currently working with Laravel 12.13 and facing an issue with CORS. I have configured the HandleCors middleware and the CORS settings in my application, but I am still getting CORS errors when ...
3
votes
0
answers
101
views
Implicit model binding fails when using {locale} prefix in routes
I'm working on a multilingual Laravel 12 app. All my routes are grouped under a {locale} prefix, like this:
Route::prefix('{locale}')
->group(function () {
Route::get('/activities/{...
2
votes
2
answers
103
views
PHP new DateTime() with unix timestamp ignores Timezone for application and also explicit Timezone in constructor
I have an object which have created property like unix timestamp integer.
I try to convert this property to DateTime object and supposed the PHP will set up correct Timezone according application ...
2
votes
1
answer
111
views
Assets not being loaded in Laravel 12 using storage:links
I´ve created a duplicate project of mine to upgrade from Laravel 10 to Laravel 12. As far as the PHP code, routes, and database everything went well as expected.
Yet, in my Laravel 10 project I had my ...
2
votes
1
answer
139
views
How can I append a calculated value to a pivot class at runtime?
I have an Order model that has a many-to-many relation to the Product model:
class Order extends Model
{
//...
public function products(): BelongsToMany
{
return $this->...
1
vote
2
answers
182
views
Backend Laravel api and frontend vuejs works in dev but not in production on a shared hosting
I am trying to deploy an application on a shared hosting (LWS).
My app uses Laravel12 as a backend and Vuejs as frontend
The frontend is installed directly on the domain.fr and the backend on a ...
1
vote
2
answers
962
views
Laravel 12 custom Exception
I want to use different error pages for the admin panel and the frontend in Laravel 12. I created a custom exception class for this purpose, but I haven’t figured out how to activate or use it yet. ...
1
vote
2
answers
557
views
Middleware exceptions do not work in Laravel 12
I'm doing an online course to learn Laravel, and I have decided to follow it using the latest version of Laravel.
The person on the videos uses an older version of Laravel, so obviously some of the ...
1
vote
1
answer
42
views
How can ship multiple different sources for the laravel-vite-plugin besides app.js?
Currently the app has 2 entry points for the JS and CSS files in the blade layout file:
{{-- layout.blade.php --}}
<head>
<meta charset="utf-8" />
<meta name="...
1
vote
1
answer
74
views
On passing json stringify data to controller method shows null
I am trying to post my form data using ajax. I am serializing the form data before posting. But at the controller method, it shows null. There is no problem with the form data because I can pass data ...
1
vote
1
answer
53
views
retrieve data using where condition and sort in descending order
I am trying to retrieve category (id, category_name, status) table data using where condition and sort in descending order for id. I am writing query like::
public function category()
{
$...
1
vote
1
answer
77
views
Why in element-plus date-picker component on save lose 1 day?
In Laravel 12 / vuejs 33.5.13 / element-plus 2.9.5 app I use date-picker component
<el-dialog v-model="dialogVisible" title="Select Day">
<el-form :model="form&...
1
vote
1
answer
854
views
Laravel V12 authentication redirects to /home instead of custom URL
I am using built-in authentication for login and registration with the following command:
php artisan ui bootstrap --auth
Now, the problem is that I am already logged into my site. When I open another ...
1
vote
0
answers
30
views
Laravel 12: Run scheduled command at 07:00 UK time while server is on UTC
I’m using Laravel 12 and I want to run a scheduled command every day at 07:00 UK (Europe/London) time, but my server is configured with UTC timezone.
In my bootstrap/app.php I have and its working:
$...
1
vote
1
answer
43
views
Inertia routes return 404 (Not Found) for app deployed in subfolder
I have deployed a Laravel 12 + Inertia.js (React) app on a shared hosting (cPanel).
The app is located in a subfolder: https://mydomaine/app/.
Authentication routes like:
https://mydomaine/app/login
...
1
vote
1
answer
123
views
storage:link not creating symlink in public folder
I'm working on a Laravel 12 project using XAMPP on Windows 10.
I tried to use the following command to create the symbolic link for serving uploaded files:
php artisan storage:link
But the public/...
1
vote
2
answers
103
views
Laravel Spatie Role/Permission - Integrity constraint violation: 1048 Column 'team_id' cannot be null ---> insert into model_has_roles
I am using Laravel V:12 and Spatie Role/Permission V:6. for multiple roles (super_admin, sub_admin, user, sub_user). I created one seeder for creating an admin user and its role/permission.
At the ...
1
vote
1
answer
274
views
Laravel 12 creates a new session on each request
I created a new Laravel 12 application following the Installation guide. The project is generated correctly and I ran all migrations.
When I run php artisan --version I get: Laravel Framework 12.20.0 (...
1
vote
1
answer
52
views
jquery data table features not working with dynamic table
My datatable is working fine, all the features like pagination, sorting, searching are working with static table data content.
But when I fetch data from database and render in datatable features like ...
1
vote
0
answers
100
views
Schema dump not working in laravel 12 windows
I am trying to dump my mysql schema in laravel project using the following laravel artisan command but gets error on windows 10 machine. I am using windows powershell (PS).
php artisan schema:dump
# ...
1
vote
0
answers
102
views
Problems reading my own cookie in other parts of my Laravel app
I have a simple form where users come to report who they helped, and how. It is anonymous in the fact that they do not have to login in, but they are asked to provide their name. They will make many ...
1
vote
1
answer
124
views
How to get the session value set in the API controller
I'm using laravel 12.0.1 and try to check the user is logged in or not in the middleware.
I set the session value in api Controller, but when I call this value in the middleware, it is null.
And my ...
1
vote
0
answers
123
views
How to Use Laravel Reverb with the Livewire Starter Kit in Laravel 12?
I'm trying to use Laravel Reverb in a Laravel 12 application. I've gone through several tutorials and documentation, but almost all of them implement authentication using Laravel Breeze. However, with ...
1
vote
2
answers
90
views
Why does my tailwindcss styled select look different to the example HyperUI element?
I'm trying to use the Base (Dark) select element from HyperUI.
https://www.hyperui.dev/components/application/selects
Of note is the height of the element, and the styling of the handle.
However, ...
1
vote
0
answers
376
views
Cors error in laravel-12 api that is called from react
Hi im trying to do a app using react as front-end and laravel 12 as api doing AJAX requests i can create users from bruno but when i trying with my react app i always receive the following CORS error:...
1
vote
1
answer
39
views
Validation Rule with notexists
I have a table called "Terroir" with some parameters.
Schema::create('terroirs', function (Blueprint $table) {
$table->id();
$table->string('name', 255);
$table-...
1
vote
0
answers
232
views
Laravel session values are deleted immediately (Laravel 12)
I create session and session values are deleted when I refresh the page. I make the user login and when I refresh the page, auth()->user() returns me NULL value as if there is no one logged in. ...
0
votes
2
answers
65
views
Apply same CSS styles to divs in the arithmetic sequence of three
I have 10 items in my database table. I want to apply same CSS style to the divs in the arithmetic sequence of 3 items.
For example, items [0, 3,6,9] will have CSS style slideInDown, items [1,4,7] ...
Advice
0
votes
5
replies
149
views
Why does Laravel 12 load routes in the bootstrap file instead of RouteServiceProvider
In Laravel 10, we had a RouteServiceProvider class that handled loading up all your different routes. This is a snippet from that file in an older project I worked on using Laravel 10:
...
0
votes
1
answer
176
views
style css not working after uploading file to a server in laravel 12
I am new in laravel 12. I have a project in laravel 12. My custom CSS file is completely working in localhost after i run npm run dev, then i run npm run build to upload the project to my own server, ...
0
votes
1
answer
118
views
load image in select dropdown list
I have a dropdown list, here in the option I want to load image also. I took reference from:
i want to display image in select option dynamically but not working
But the image is not loading. The path ...
0
votes
2
answers
86
views
create model and controllers inside specific directory
How to write artisan command to create model and controller inside specific directories.
If I do this command::
php artisan make:model Post -mcr
it create Post controller inside controllers folder, ...
0
votes
1
answer
155
views
Laravel Auditing Not Logging old_values and new_values When Using Observer
I'm working with Laravel Filament where I'm using audits package for audits the activity of laravel model. I've laravel model like:
<?php
namespace App\Models;
use App\Casts\Money;
use App\...
0
votes
1
answer
105
views
Bug with @foreach loop in Laravel 12.x + Livewire 3.6
I am using Laravel v12 with Filament v4 and TailwindCSS v4.
I wanted to build a site with tabs, witch are a Livewire component inside filament/Page. In this Livewire components I have 3 tabs, where ...
0
votes
1
answer
66
views
File not found when trying to display a background image from a CSS file
I have an svg file placed in /public/assets/icons, and I try to use it from within a CSS file:
.some-icon {
background-image: url("/assets/icons/arrow.svg");
}
I get error 404 Not Found ...
0
votes
1
answer
59
views
can not update data using select statement for where condition
I am trying to update data with where condition. I am trying to get the where condition of update statement from the select statement. But in this case the data is not updated.
public function update(...
0
votes
2
answers
89
views
How to get inserted model or collection when using fillAndInsert which just returns a boolean?
$transactionsData is an array, and I want the id from transaction id from the transaction model for each item and assign it to the details to insert the id to the transaction item table, how can I ...
0
votes
1
answer
85
views
Laravel: Google is indexing my site with subdomains, which are now obsolete. How to redirect?
In my app I had ca. 20 subdomains. Now they are gone and https certificates with them.
However, Google is indexing my site with use of the subdomains, which was never my intention.
Example:
Google ...
0
votes
2
answers
59
views
access form data in controller via request variable
I have a form modal and I am trying to send data using ajax post method to the controller method 'store' via my blade file.
//// temp.blade.php file
<script type="text/javascript">...
0
votes
1
answer
92
views
No Laravel response when receiving MS Graph Subscription webhook (despite it being processed.)
This one has me confused!
Update Fri May 30th
I was able to create the subscription and the webhook was called and Laravel responded correctly. I think it has something to do with the local laravel ...
0
votes
1
answer
110
views
How to re-render all nested components?
I've implemented a nested search-select component using a Flux input with a dropdown to display database results.
The component's structure:
<div class="relative flex-grow" x-data=&...
0
votes
1
answer
213
views
Issues writing response from Illuminate\Support\Facades\Http::post to session
In Laravel 12, I have a controller function that looks a little bit like this (it's pseudo code, so any typos are incidental to my question; the code works in principle):
public function getRemoteData ...
0
votes
1
answer
420
views
Unexpected ")" CSS syntax error when npm run build a TailwindCSS v4 project
The whole project was building without much problems but since one or two days (and most probably after composer & npm) update/upgrades) it will return the following:
npm run build
> build
>...
0
votes
2
answers
175
views
Problem with Ajax in Laravel 12 Yajrabox Datatables
When I try to execute datatable with ajax in the TeacherController function show(Teacher $teacher) with foreign_key, I get Ajax Error even though in AssistanceTeacherController it does work in its ...
0
votes
1
answer
85
views
How to add routes in laravel 12 [closed]
Fresh new installation of Laravel 12
composer create-project --prefer-dist laravel/laravel api
cd api
composer update
sudo chmod -R 775 storage
sudo chown -R www-data:www-data storage
sudo chmod -R ...
Best practices
0
votes
1
replies
37
views
Ignore parent Model Scope in a Child model
I have two models with global scopes.
#[ScopedBy(UserScope::class)]
class User {}
#[ScopedBy(ViewerScope::class)]
class Viewer extends User {}
The scope just checks if class instance has is_viewer ==...
0
votes
0
answers
37
views
Is it possible to import an entire css folder to the Vite compilation in Laravel 12?
I am using the Laravel 12 + React starter kit, and I want to create several components, for example:
app/resources/js/components/Navbar.tsx
app/resources/js/components/Footer.tsx
app/resources/js/...
0
votes
0
answers
21
views
Laravel 12 + React starter kit - what is the proper way to set the "dir" attribute in the HTML element? [duplicate]
Right now, I can set the lang attribute by changing the value of locale inside /config/app.php, but I also want to set the dir attribute.
I can do something like that inside the /resources/views/app....
Advice
0
votes
0
replies
48
views
How to properly build an HR Management System using Laravel (API) + Next.js (frontend) with token authentication and middleware?
I'm building an HR Management System using:
Backend: Laravel
Frontend: Next.js
Authentication(SPA): Laravel Breeze (already set up for backend)
I'm a beginner in Next.js, and I’m a bit stuck on how ...