Search
 
SCRIPT & CODE EXAMPLE
 

PHP

adding field to array on condition laravel

return [
        'id' => $this->id,
        'name' => $this->name,
        'email' => $this->email,
        $this->mergeWhen(Auth::user()->isAdmin(), [
            'first-secret' => 'value',
            'second-secret' => 'value',
        ]),
        'created_at' => $this->created_at,
        'updated_at' => $this->updated_at,
    ];
Comment

PREVIOUS NEXT
Code Example
Php :: laravel | eloquent | db | randomly fetch | query data 
Php :: how to change laravel logo image 
Php :: schema key issue laravel 
Php :: add p tag back in wordpress 
Php :: installer composer dans ionos 
Php :: laravel api get controller 
Php :: laravel collection intersectKey 
Php :: woo variable product get field 
Php :: how do i implement blockchain payments on laravel website 
Php :: laravel count 
Php :: codeigniter sanitize array in php 
Php :: php define() 
Php :: date fomat in php 
Php :: find_by model fuelphp 
Php :: default time zone for europe php 
Php :: gmail smtp not working laravel 
Php :: php string concat 
Php :: php remove new line character from string 
Php :: Comment ajouter un fil d’Ariane personnalisé à l’URL d’accueil dans WooCommerce 
Php :: afiseaza id-ul sesiunii php 
Php :: what is WP_USE_THEMES 
Php :: WPML - Add a floating language switcher to the footer 
Php :: flexslider in laravel 5.8 
Php :: php decode base64 online 
Php :: Laravel: validate an integer field that needs to be greater than another 
Php :: how to pass javascript variable to php 
Php :: Target class [HomeController] does not exist. 
Php :: laravel 8 ui auth 
Php :: how to fix 419 page expired in laravel 
Php :: hook de pré-commit se déclenche 
ADD CONTENT
Topic
Content
Source link
Name
1+9 =