Laravel 8 Add Custom Column Query Example
Hello Dev,
In the present day, i we’ll present you laravel eight add customized column question instance. This text offers you easy instance of laravel eight add customized column question instance. you’ll be taught laravel eight add customized column question instance. So let’s comply with few step to create instance of laravel eight add customized column question instance.
<?php namespace AppHttpControllers; use AppModelsUser; use DB; class UserController extends Controller { /** * Write code on Technique * * @return response() */ public operate index() { $customers = Consumer::choose([ "id", "name", DB::raw("'Admin' as type"), DB::raw("1 as active") ])->get(); dd($users->toArray()); } }
Output:
Array ( [0] => Array ( [id] => 1 [name] => codeplaners [type] => Admin [active] => 1 ) [1] => Array ( [id] => 2 [name] => rakesh [type] => Admin [active] => 1 ) )
Komentar
Posting Komentar