In my database I have categories and sizes, they have a table to match them together called category_sizes which looks like:
I want to get an array with all size_id where category_id = 4 so I did:
$catSizes = CategorySize::where('category_id', 4)->value('size_id');
return($catSizes);
But it returns one result only. How can I get an array with all size_ids so I can use it later in a where_in statement.
I also tried pluck but this gives also just one row.
$catSizes = CategorySize::where('category_id', 4)->pluck('size_id');
dd($catSizes);
My CategoySize model
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class CategorySize extends Model
{
protected $table = 'category_sizes';
}
