Как переделать такой вот запрос в orm Вот один из таких запросов:
DB::table('matches as m')
->select('*','t1.image as image_one','t2.image as image_two','m.id as id_bets','t1.id as id_team_1', 't2.id as id_team_2')
->join('teams AS t1','t1.name','=','m.name_one')
->join('teams AS t2','t2.name','=','m.name_two')
->where('m.status','=','1')
->get();
Вот модель Match:
class Match extends Model
{
protected $fillable = [
'user_id', 'event', 'name_one', 'name_two','balans_one','balans_two','data_event', 'status','win_team','lose_team','koof_one','proc_win_one','koof_two','proc_win_two',
];
public function user()
{
return $this->belongsTo('App\User');
}
}
И вот модель Team:
class Team extends Model
{
public $timestamps = false;
protected $fillable = [
'id', 'name', 'image',
];
}
И как в Eloquent ORM использовать два "where" в одном запросе?