Using WhereIn

$whereTypes = ['png','jpeg','JPG','jpg'];
$media = PostFile::where('post_id', $post->id)->whereIn('type', $whereTypes)->first();

Related Posts


Updating multiple rows

Using Like

Using orWhere

What is Query Builder?

Using "with" in eloquent query

Getting last inserted id

Selecting last row of a table

Using parameters in find() method

Using local scope in eloquent

Using global scope in eloquent