Category "laravel"

To call class only once in laravel

I have laravel application and I have used singleton pattern public function boot/register() { $this->app->singleton( 'className',

Star and Half Star Rating in Laravel

I want to display average product ratings in star. The values are displaying good but I want to show half star if the value is in float. My blade view: <div

Why Notification is queued in redis without implements ShouldQueue?

In laravel 9 app I use queues with redis and for that in notifications which must be queued I wrote : class CurrencyRatesImportRunNotification extends Notificat

Laravel Blade component method not rendering in cpanel-server but work in my localhost

I have a component RemoveBook in app/View/Components/RemoveBook and the blade component in resources/views/components/sections/parts/remove-book.blade.php. all

Laravel 8 factory state afterCreating

Laravel 7 factories had method afterCreatingState() where you could define what should happen after Model with specific state was saved into database. $factory-

Laravel Model save() & update() Not Saving

Laravel 5.7 Hello I have been looking through stack overflow and have tried many possible answers and have come to no conclusions. I am updating a simple inte

Localhost is currently unable to handle this request. HTTP ERROR 500 with laravel app in Win 10

I have imported Laravel app inside my PC (Win 10) and put it in htdocs folder then I have changed the default directory which will serve me when type "localhost

Passing a boolean value from checkbox in Laravel form

I am trying to save boolean value when I create a new Post and then have it update the value if I update the Post. When I create a new Post and save, it persist

laravel and phpunit: could not find driver (SQL: PRAGMA foreign_keys = ON;)

I have run my laravel app with phpunit. Everything is fine until at some point when I run my test again turns out with this error. Illuminate\Database\QueryExce

Laravel Multi-language routes without prefix

Currently, my system is using 2 languages which is English and German. my goal is to browse following routes by switching between the mentioned language - bas

Laravel Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) on a sub query with "ROW_NUMBER() OVER PARTITION"

I know there are tons of question that includes that error, but I haven't seen one that incldues a subquery with row_numbers. Ok so I have this raw query which

How to fix laravel composer update issue ( Illuminate\Foundation\ComposerScripts::postAutoloadDump failed to open stream: No such file or directory)

I'm currently working on a laravel project using an existing package for e-commerce functionality called Bagisto. I already downloaded the package files from th

Cross-Origin Resource Sharing (CORS) witth Laravel and Vuejs

I have in backend this link backend.com and for frontend frontend.com I want to lock my API backend for everyone except my frontend! my cors.php <?php retur

jQuery not working in vue component when change route

I have an issue with jQuery script files is not working inside vue component but it working outside it, I found a solution to put all script files in script sec

Laravel empty pagination data

My query from Laravel Builder toSql() function. select `dispatcher_leads`.*, (select CASE WHEN lead_positions.order_type = 'shift' THEN DATE_ADD(lead_positions

Laravel Query Builder in Model

I would like to know if is it possible to work in a model using query builder to make a join between 4 tables, I don't know how to use eloquent with 4 tables th

Target class controller does not exist - Laravel 8

Here is my controller: <?php namespace App\Http\Controllers\Api; use App\Http\Controllers\Controller; use Illuminate\Http\Request; class RegisterControlle

Laravel's localization on JavaScript Variables

I have some JavaScript variables that I output on a rating scale as shown below. I now want to achieve Laravel's localization therefore translate the variables

How to get array values using foreach in laravel

I am new to laravel and php. I have this code in one of my controllers: $group_by_precedence = array("true", "false"); And this code in the view: @foreach ($gr

Is it possible to change the table name in the migration file-laravel

I created a migration file using php artisan make:migration create_todoapps_table. The migration file was created with the table name as to_do_apps (Schem