1use Illuminate\Support\Facades\DB;
2
3class UserController extends Controller
4{
5 public function index()
6 {
7 $users = DB::table('users')->select('id','name','email')->get();
8
9 return view('some-view')->with('users', $users);
10 }
11}
12
1use Illuminate\Support\Facades\DB;
2
3$users = DB::table('users')
4 ->select('name', 'email as user_email')
5 ->get();
1use Illuminate\Database\Eloquent\Builder;
2
3public function scopeFakePersons(Builder $query): Builder
4{
5 return $query->where('is_fake', 1);
6}