929 questions
3 votes
2 answers
89 views
Automatically set timestamps on polymorphic relation table
I have a ProductLandedCost model with a morphToMany relationship to various other models: Warehouse, for example: class Warehouse extends Model { // ... public function productLandedCosts(): ...
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(...
2 votes
0 answers
121 views
Why does my queued job in Laravel 10 not execute after dispatch?
I have a fresh Laravel 10 app and I'm trying to test queues. I created a job with php artisan make:job TestJob. routes/web.php Route::get('/test-job', function () { \App\Jobs\TestJob::dispatch(); ...
2 votes
0 answers
104 views
How to fix “Class not found” error in Laravel 10 when running artisan command?
I’m working on a Laravel 10 project and ran into a Class not found error when executing an artisan command. Goal: I want to create a custom artisan command that fetches data from the database. Problem:...
-1 votes
1 answer
163 views
Binding Livewire nested data insertion using Alpine js
In screenshot below i have a set of data insertion which contains each parent might have o to 6 children : when i try to get data in my livewire blade (the part facing issue) like below: <div ...
-2 votes
2 answers
132 views
Json response not rendering to html table, only shows raw json data [closed]
I am returning json response from index method of my controller class. use App\Http\Controllers\Controller; use Illuminate\Http\Request; use App\Models\Admin\Services\Finish; class FinishController ...
0 votes
4 answers
179 views
Passing parameter to route function from ajax
I am trying to call a controller method using ajax. But I do not know how to do it? I have tried several ways but can not find the right one. My controller method:: use App\Http\Controllers\Controller;...
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 ...
-1 votes
1 answer
69 views
Catching errors of model in controller method
I have a controller method which I am using to change the status of the row data in the database. But I forget to mention status field in the model file. So the status was not changing in the database....
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] ...
2 votes
2 answers
127 views
Latest Telescope does not work if Laravel is in a subfolder & Quick Fix Also Not Working
Telescope Version : 5.10 Laravel Version : 10.48.29 PHP Version : 8.3.11 Issue Laravel runs in a subfolder. This means only urls starting with /foo/ get routed to Laravel's index.php. Other ...
0 votes
1 answer
34 views
How to put --select zone-- as default value on the dropdown input
working with Laravel 10 backend and I have following dropdown for select zone name and existing system show some zone name from table. but I need show --select zone-- as the default value of the ...
0 votes
1 answer
97 views
Laravel - create facade partial mock
I created an helper class that wraps http calls to an external service using the Http facade: all the methods basically wraps the same http call structure: Http::withHeaders()->post() or get() ...
2 votes
1 answer
160 views
Laravel Auth::user() returns null on 404 error page, even when user is logged in in laravel 10
I'm building a Laravel app where the main layout (layouts.app) is used across all pages. However, I include the header (which contains the user dropdown based on Auth::user()) via a separate @include('...
0 votes
1 answer
73 views
One to many relationship issue
I'm new to Laravel. I'm trying to use HasTo relationship. I have 2 tables in database. One is the products and the other one is categories. I use a form to add a product. In the form there is a select ...