© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
10 replies
nighty

Repeater - Array to String Conversion when save - logImplodeAssoc

i am on my first testing to store json arrays into database with repeater.

- the database column was changed to JSON with a migration
- the Model got:
protected $casts = ['urls' => 'json'];
protected $casts = ['urls' => 'json'];

- output is also working

but a related error message will be thown when saving the form - i am not sure if i am doing something wrong, or it´s a bug:

Array to string conversion

 /**
     * Format an assoc array as a key/value string for logging
     * @return string
     */

    public static function logImplodeAssoc(array $attrs): string {
        $l = '';
        foreach( $attrs as $k => $v ) {
          **  $l .= "{ $k => $v } ";**
        }
        return $l;
    }
 /**
     * Format an assoc array as a key/value string for logging
     * @return string
     */

    public static function logImplodeAssoc(array $attrs): string {
        $l = '';
        foreach( $attrs as $k => $v ) {
          **  $l .= "{ $k => $v } ";**
        }
        return $l;
    }


Repeater:
 Repeater::make('urls')->schema([
                        TextInput::make('Stream-URL')
                    ])
                    ->hidden(function(Get $get){
                        if(!in_array($get('type'),[9,7,11,10])){
                            return true;
                        }
                        return false;
                    }),
 Repeater::make('urls')->schema([
                        TextInput::make('Stream-URL')
                    ])
                    ->hidden(function(Get $get){
                        if(!in_array($get('type'),[9,7,11,10])){
                            return true;
                        }
                        return false;
                    }),


TextColumn:
  TextColumn::make('outstream.urls')->state(function(Model $record){
                    $out = '';
                    foreach((array)$record->outipstream->urls as $url){
                        $out .= $url['Stream-URL'].' ';
                    }
                    return $out;
                }),
  TextColumn::make('outstream.urls')->state(function(Model $record){
                    $out = '';
                    foreach((array)$record->outipstream->urls as $url){
                        $out .= $url['Stream-URL'].' ';
                    }
                    return $out;
                }),
Solution
it says that function is in app/Traits/Observable.php, that is in your app, not filament or laravel.
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

repeater field - giving array to string conversion error
FilamentFFilament / ❓┊help
3y ago
error: Array to string conversion
FilamentFFilament / ❓┊help
2y ago
Array to String Conversion Problem
FilamentFFilament / ❓┊help
2y ago
ColumnSpan : Array to string conversion
FilamentFFilament / ❓┊help
3y ago