Answers for "laravel eloquent select as"

PHP
2

eloquent with select

Post::query()
    ->with(array('user' => function($query) {
        $query->select('id','username');
    }))
    ->get();
Posted by: Guest on August-07-2021
0

laravel sql query

use Illuminate\Support\Facades\DB;

$users = DB::select('select * from users');

foreach ($users as $user) {
    echo $user->name;
}
Posted by: Guest on January-07-2021
0

laravel db inserr

DB::table('users')->insertOrIgnore([
    ['id' => 1, 'email' => '[email protected]'],
    ['id' => 2, 'email' => '[email protected]'],
]);
Posted by: Guest on January-23-2021

Code answers related to "laravel eloquent select as"

Browse Popular Code Answers by Language