Answers for "join with on laravel"

PHP
1

join in laravel

$subCategories = Subcategory::join('categories', 'subcategories.category_id', '=', 'categories.id')
                              ->select('subcategories.*', 'categories.name AS cname')
                              ->orderBy('id', 'desc')
                              ->get();
Posted by: Guest on January-26-2021
2

DB::table('users')->get();

DB::select('SELECT * FROM users WHERE name = ?', array(Input::get('name')));
Posted by: Guest on October-22-2020
2

query builder laravel

use Illuminate\Database\Eloquent\Builder;

public function scopeFakePersons(Builder $query): Builder
{
  return $query->where('is_fake', 1);
}
Posted by: Guest on January-20-2021

Browse Popular Code Answers by Language