Browse AI Field GuideForum Podcast
All ThreadsLeaderboard
  1. Discussions

    1. Popular This Week
    2. Popular All Time
    3. Solved
    4. Unsolved
    5. No Replies Yet

minaremonshaker's avatar

Testing Best Practices: Is Using Foreach Loops in Tests an Anti-Pattern?

I'm working on my Laravel test suite and I've noticed I'm using foreach loops in several of my tests to iterate through different scenarios or test data. While this approach seems efficient for testing multiple cases, I'm wondering if it's considered a good practice or if there are better alternatives. My concerns are: If one assertion fails, does it stop the entire test? Does

minaremonshaker's avatar
minaremonshaker's avatar minaremons...7mos agoTesting
7
1
Last reply by minaremonshaker 7mos ago
mankowitz's avatar

Queued emails are (intermittently) not sent, but jobs are completing successfully.

I have queued emails which work... some of the time. After a few hours, the queued jobs are created, processed and marked as done, but there is no communication with the smtp server (microsoft exchange). Some relevant code is below: In the controller: // $bcc = list of addresses Mail::to('[email protected]')->bcc($bcc)->send(new NewPatientNotifi

mankowitz's avatar
mankowitz's avatar yacine_df7mos agoLaravel
6
1
Last reply by yacine_df 7mos ago
makhlugjafarov's avatar

Recurring Issue with Missing api.php and Service Providers in Fresh Laravel Installations

Hello Laracasts Community, I'm encountering a persistent issue with Laravel installations on my macOS environment and I'm seeking insights or advice from the community. Issue Description: In every new Laravel project I create, I'm noticing that the api.php file is missing from the routes directory. Moreover, the app/Providers directory is lacking several of the standard service

makhlugjafarov's avatar
makhlugjafarov's avatar mah3uz7mos agoLaravel
3
1,392
Last reply by mah3uz 7mos ago
shaungbhone's avatar

Spatie Laravel PDF error

I got an error with spatie laravel pdf. I already installed all requirement from docs. Using - Mac - Safari - Herd The command "PATH=$PATH:/usr/local/bin:/opt/homebrew/bin NODE_PATH=`npm root -g` node '/Users/shaungbhone/Herd/weshop/vendor/spatie/browsershot/src/../bin/browser.cjs' '{"url":"file:\/\/\/var\/tmp\/89399023-0225763001727011898\/index.html"

shaungbhone's avatar
shaungbhone's avatar shaungbhon...7mos agoLaravel
2
1
Last reply by shaungbhone 7mos ago
bjugan's avatar

Maximum one job waiting in queue

Hi, I have a job that synchronizes data from system A to system B, by finding and synchronizes all changed data in system A since the last job run. This job is dispatched to queue when data in system A changes. This can sometimes happen multiple times per second. I can only run one of these jobs at a time to prevent a race condition, and I use the WithoutOverlapping middleware

bjugan's avatar
bjugan's avatar bjugan7mos agoLaravel
14
1
Last reply by bjugan 7mos ago
j-miller-dev's avatar

PHP & MYSql book worth working through?

I'm on the "path". I know this book is optional but did anyone work through it and find it helpful with consolidating knowledge? Thanks :)

j-miller-dev's avatar
j-miller-dev's avatar LaryAI7mos agoPHP
1
2
Last reply by LaryAI 7mos ago
webrobert's avatar

prevent default on drag/sorting

Desired result I want the item to be clickable link. BUT also IF the user moves the item by dragging it to disable the click. Im not sure how to access the javascript event. The sorting works... but adding the link to the element it sends the page as soon as the dragging stops/drops Setup I am using Livewire Sortable.js, its a wrapper for SortableJS so apparently all the optio

webrobert's avatar
webrobert's avatar bmooreitul7mos agoJavaScript
7
45
Last reply by bmooreitul 7mos ago
maxkhim's avatar

Showcase: I built Dedupler - tool prevents duplicate files

The Problem: Users upload the same file multiple times, storage gets bloated, backups grow unnecessarily. The Solution: I built Dedupler - Laravel package that automatically prevents duplicate ( github.com/maxkhim/laravel-storage-dedupler ) file storage using SHA-1 hashing. Check potential disk space savings If you install in legacy project you can calculate efficiency of using

maxkhim's avatar
maxkhim's avatar maxkhim7mos agoLaravel
0
1
bearbytestudio's avatar

How to best handle jobs which will take 5 minutes or longer to complete

I have a few jobs in my app which are dispatched onto a queue (we use Horizon to run our queues), and can take anywhere up to 10 minutes to complete their work. For reasons I cannot pin down, seemingly when no errors happen, I get the jobs rerunning and re-dispatching onto the queue even when one is in progress already. The only logs in my log file are saying "MaxAttemptsE

bearbytestudio's avatar
bearbytestudio's avatar bearbytest...7mos agoLaravel
2
1
Last reply by bearbytestudio 7mos ago
Iagoss's avatar

Difficulty scaling Laravel Horizon across multiple instances (ECS / Auto Scaling)

Hello everyone 👋 I’m deploying a Laravel application in a containerized architecture (AWS ECS), where I’ve split services into three separate tasks: Web (HTTP requests) Horizon (job processing) Scheduling (cron tasks) Each service has its own auto scaling policy, so new instances can be created dynamically as demand increases. The issue I’m facing is that when trying to scale H

Iagoss's avatar
Iagoss's avatar Iagoss7mos agoLaravel
0
1
SeanIz's avatar

Setting a default value to an input.

public function store(Request $request, Survey $survey, $questionnaireId) { $data = $request->validate([ 'responses' => 'required|array', 'responses.*.question_tag' => 'required', 'responses.*.question_id' => 'required', 'responses.*.question_category' => 'required', 'responses.*.answer_id' =

SeanIz's avatar
SeanIz's avatar Go3shom7mos agoLaravel
5
4
Last reply by Go3shom 7mos ago
maxxd's avatar

Reverb issue in PusherBroadcaster

Hi all. I'm working to get reverb up and running in our system and have hit a strange error. It looks like things are set up correctly - when I start the reverb server (using the --debug option) I see that it's subscribed to all the channels that I'm working with, and I see the pusher pings coming through. When I dispatch an event on the channel reverb is listening to, I get th

maxxd's avatar
maxxd's avatar maxxd7mos agoReverb
0
1
Smiffy's avatar

Allowing access to url when in maintenance mode via a package

I have a package which defines, in its config, a url. This url should be available even when the site is in maintenance mode. I know that you can add to the $except array of App\Http\Middleware\PreventRequestsDuringMaintenance but it would be great if my package can automatically add the url into the $except array rather than ask the user of my package to remember to do this. I

Smiffy's avatar
Smiffy's avatar Amaury7mos agoLaravel
3
1
Last reply by Amaury 7mos ago
beachcomberdigital's avatar

Unable to deploy after forge upgrade - "Please provide a valid cache path"

I keep getting an error on deploying a project after the recent upgrade to Forge - everything was deploying without issue prior to the updated release of forge. On each deployment, attempt it hits the following error: 156/156 [============================] 100% Generating optimized autoload files > Illuminate\Foundation\ComposerScripts::postAutoloadDump > @php artisan pac

beachcomberdigital's avatar
beachcomberdigital's avatar LaryAI7mos agoForge
1
1
Last reply by LaryAI 7mos ago
Ispilledteaonthecarpet's avatar

Hide AI Summary

Hello, Probably a minor thing, but I think the AI summary under the videos take a big portion of the page and makes the comments hard to reach. The page does not seem to have been designed with such a long text in mind so it just does not fit with current layout as it is. There is also no clear visual distinction between the two sections. If you scroll quickly through the page

Ispilledteaonthecarpet's avatar
Ispilledteaonthecarpet's avatar Ispilledte...7mos agoAI
1
2
Last reply by Ispilledteaonthecarpet 7mos ago
thesimons's avatar

Filament 4 doesn't trigger email function

Hello, I'm trying all functions to send out email from filament "components" (like password reset, etc ...) but unfortunately normal has been sent. Outside Filament emails are sent properly. Thanks, Simon

thesimons's avatar
thesimons's avatar thesimons7mos agoFilament
3
1
Last reply by thesimons 7mos ago
lararara's avatar

CORS Error with Cloudflare R2 Private Bucket, Filament Spatie Media Upload Plugin

I cannot upload images in Filament with Filament Spatie Media Upload Plugin, it's always giving me a 403 CORS Missing Allow Origin. This is the plugin, https://filamentphp.com/plugins/filament-spatie-media-library, and the only thing it mentions for using private uploads is setting the visibility to private. I can confirm this isn't an issue with setting up R2 on my Laravel pro

lararara's avatar
lararara's avatar sirabdull7mos agoFilament
3
27
Last reply by sirabdull 7mos ago
earmsby's avatar

Image column

I'm trying to display a thumbnail of an image uploaded to a Filament app. The form field for the image upload is: FileUpload::make('file_path') ->disk('public') ->directory('uploads') ->visibility('public') I can see that the image is in the directory: storage\public\uploads Then, my table column is: ImageCol

earmsby's avatar
earmsby's avatar Glukinho7mos agoFilament
8
5
Last reply by Glukinho 7mos ago
Pixelairport's avatar

Filament Pest test throws 403 for actingUser

Hi. I create an package to create authors and want to test it. I use orchestra, pest and filament. This is my code: use Workbench\App\Models\User; test('Only users can access authors.', function () { $this->get('/admin/authors')->assertStatus(302)->assertRedirect('/admin/login'); $this->actingAs(User::factory()->create()); $this->get('/admin

Pixelairport's avatar
Pixelairport's avatar Pixelairpo...7mos agoTesting
10
3
Last reply by Pixelairport 7mos ago
rotaercz's avatar

Is there an easy way to add Typesense using Laravel Forge?

So I have an existing web app using Laravel Forge. I'd like to add Typesense without having to provision a new server. I was wondering if there is an easy way to do this using Forge? My development environment is Laravel Sail if that makes any difference.

rotaercz's avatar
rotaercz's avatar dushano7mos agoForge
6
7
Last reply by dushano 7mos ago
vincent15000's avatar

Str::pluralStudly() not working in french

Hello, https://laravel.com/docs/12.x/strings#method-str-plural-studly https://laravel.com/docs/12.x/localization#pluralization-language Perhaps I forgot some configuration ? I have tried to change the language to fr in the app.php file, but it doesn't work better. Well ... it works only if I add Pluralizer::useLanguage('french'); to the AppServiceProvider, but then I also have

vincent15000's avatar
vincent15000's avatar Glukinho7mos agoLaravel
3
1
Last reply by Glukinho 7mos ago
Maniheshmati's avatar

Algolia Search in documentation not working

Hii everyone. I was reading documentations and then I wanted to search for "HasMany" relation in documentions. As you know ther is a "Super + K" shortcut. A pop up input will come to your screen labled "Search by Algolia". But it didn't work for me at all. I have tried "HasMany", "Eloquent", and "Security" but nothing

Maniheshmati's avatar
Maniheshmati's avatar Glukinho7mos agoLaravel
3
1
Last reply by Glukinho 7mos ago
User1980's avatar

Unable to get Laravel ECHO to receive event data in vue js

Hello everyone, Been really struggling with this and I cannot find a way around. I am building a NON SPA which uses vues components inside blade files. The problem seems to come from vue js as I am sending correctly the event via the websockets. No errors showing in my vue console. This is my vue front end. created() { window.Echo.private(`user.${this.userId}`)

User1980's avatar
User1980's avatar JacobWiley7mos agoLaravel
4
1
Last reply by JacobWiley 7mos ago
wim91's avatar

Is it possible to do conditional validation in Laravel?

Hello everyone. I have a form with fields for employee name and job title. When validating, if there's no employee name, there shouldn't be a job title. I understand that, in theory, I could create a condition for the received data to be empty, and also create client-side dependencies for whether fields are required. But is there a way to handle conditional validation using val

wim91's avatar
wim91's avatar Glukinho7mos agoLaravel
1
1
Last reply by Glukinho 7mos ago
arrrssssss's avatar

Telegram bot with laravel

Hi community, what is the best package right now to create complex telegram bot with multiple actions with laravel ? for example, a bot have 10 main commands for selling products, checking order, payments , some profile data and so on, in every command there are multiple of inline keyboard buttons in telegram bot that returns callback_data and this callback data hast to be mana

arrrssssss's avatar
arrrssssss's avatar Glukinho7mos agoLaravel
2
84
Last reply by Glukinho 7mos ago

Want us to email you occasionally with Laracasts news?

Nine out of ten doctors recommend Laracasts over competing brands. Come inside, see for yourself, and massively level up your development skills in the process.

Learn
BrowseSeriesCreatorSeriesLaravel PathLarabitsPlayground
Discuss
ForumPodcastSupport
Extras
Gift CertificatesApparelFAQiOS AppTerms
Social
X(Twitter)TikTokYoutube

© Laracasts 2026. All rights reserved. Yes, all of them. That means you, Todd.

Proudly hosted with Laravel Forge and DigitalOcean.

Want us to email you occasionally with Laracasts news?

Nine out of ten doctors recommend Laracasts over competing brands. Come inside, see for yourself, and massively level up your development skills in the process.

Learn
BrowseSeriesCreatorSeriesLaravel PathLarabitsPlayground
Discuss
ForumPodcastSupport
Extras
Gift CertificatesApparelFAQiOS AppTerms
Social
X(Twitter)TikTokYoutube

© Laracasts 2026. All rights reserved. Yes, all of them. That means you, Todd.

Proudly hosted with Laravel Forge and DigitalOcean.