© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
2 replies
Soundmit

Passing array to Blade::render for email template

I'm working on a custom email system with email template
all works fine until the variables that i pass to Blade::render are strings
but i need to sent an array

this array is a results of a repeater field and is soterd in the db as json field

this is the relevant part of my code
$accessories =  $repair->accessories;

        $variables = [
            'repairId' => $repair->id,
            'customerName' => $repair->customer->customer_name,
            'item' => $repair->brand->name.' '.$repair->item->name.' '.$repair->item->model,
            'serialNumber' => $repair->serialNumber,
            'technicianName' => $repair->technician->name,
            'customerNote' => $repair->customer_note,
            'createdAt' => $repair->created_at,
            'accessories' => $accessories,
            'appName' => env('APP_NAME')
        ];
...
$compiledContent = Blade::render($bladeContent, $variables);
$accessories =  $repair->accessories;

        $variables = [
            'repairId' => $repair->id,
            'customerName' => $repair->customer->customer_name,
            'item' => $repair->brand->name.' '.$repair->item->name.' '.$repair->item->model,
            'serialNumber' => $repair->serialNumber,
            'technicianName' => $repair->technician->name,
            'customerNote' => $repair->customer_note,
            'createdAt' => $repair->created_at,
            'accessories' => $accessories,
            'appName' => env('APP_NAME')
        ];
...
$compiledContent = Blade::render($bladeContent, $variables);

the error is

htmlspecialchars(): Argument #1 ($string) must be of type string, array given

without the accessories, works fine
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Custom widget, passing variables to blade
FilamentFFilament / ❓┊help
2y ago
How to render icon in blade template using existing filament way?
FilamentFFilament / ❓┊help
3y ago
render blade in subheading?
FilamentFFilament / ❓┊help
2y ago
Blade templates
FilamentFFilament / ❓┊help
3y ago