whereId laravel code example
Example 1: laravel join
$users = DB::table('users')
->join('contacts', 'users.id', '=', 'contacts.user_id')
->join('orders', 'users.id', '=', 'orders.user_id')
->select('users.*', 'contacts.phone', 'orders.price')
->get();
Example 2: laravel select count
$count = DB::table('category_issue')->count();
Example 3: laravel find query
// Retrieve a model by its primary key...
$flight = App\Models\Flight::find(1);
// Retrieve the first model matching the query constraints...
$flight = App\Models\Flight::where('active', 1)->first();
// Shorthand for retrieving the first model matching the query constraints...
$flight = App\Models\Flight::firstWhere('active', 1);
Example 4: laravel find query
<?php
$flights = App\Models\Flight::all();
foreach ($flights as $flight) {
echo $flight->name;
}