vendredi 2 février 2018

Laravel 5 - Extract ID from Object

I have an object in laravel 5.5 $categories that looks like this...

Illuminate\Database\Eloquent\Collection Object
(
    [items:protected] => Array
        (
            [0] => App\Category Object
                (
                    [table:protected] => categories
                    [primaryKey] => id
                    [attributes:protected] => Array
                        (
                            [id] => 22
                            [title] => Fruit
                            [slug] => fruit
                        )

                    [original:protected] => Array
                        (
                            [id] => 22
                            [title] => Fruit
                            [slug] => fruit
                        )
                )
         )

)

How can I get the id from this object? I have tried both of these...




But they are not working, how should I be extracting this value?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2DRC4rh
via IFTTT

Aucun commentaire:

Enregistrer un commentaire