Consider this code:
Products::whereIn('id', function($query){
$query->select('paper_type_id')
->from(with(new ProductCategory)->getTable())
->whereIn('category_id', ['223', '15'])
->where('active', 1);
})->get();
More Related Contents:
- Laravel one to many relation with a one to one relation
- Laravel OrderBy relationship count
- Laravel 5.2 – Use a String as a Custom Primary Key for Eloquent Table becomes 0
- Laravel $q->where() between dates
- Eloquent many-to-many-to-many – how to load distant relation easily
- Eloquent groupBy make “SQLSTATE[42000]” with valid SQL query in Laravel 5.3
- Property Property Property [title] does not exist on this collection instance does not exist on this collection instance does not exist on this collection instance
- Automatically deleting related rows in Laravel (Eloquent ORM)
- Get Specific Columns Using “With()” Function in Laravel Eloquent
- Laravel Check If Related Model Exists
- Laravel migration: unique key is too long, even if specified
- Laravel: PDOException: could not find driver
- Laravel Eloquent select all rows with max created_at
- How can I convert many statement mysql to laravel eloquent?
- Eloquent ORM Code Hinting in PhpStorm
- How to set a default attribute value for a Laravel / Eloquent model?
- “No such file or directory” or “No such host is known” when running migrations
- Laravel 5.4 on PHP 7.0: PDO Exception – Could not find driver (MySQL)
- How to create a subquery using Laravel Eloquent?
- Eloquent model mass update
- Difference between Eloquent\Model::get() and all()
- Laravel Eloquent get results grouped by days
- php artisan migrate throwing [PDO Exception] Could not find driver – Using Laravel
- Change name of Laravel’s created_at and updated_at
- How do I get database column names in Laravel?
- Laravel Eloquent: How to get only certain columns from joined tables
- Mysql InnoDB engine in Laravel
- How to get last insert id in Eloquent ORM laravel
- Laravel Many to many self referencing table only works one way
- Merge ‘with’ and ‘whereHas’ in Laravel 5