if($foo) {
$model = Model::where('id', 1);
}
if($bar) {
$model = $model->where('age', 3);
}
So this code will only run if the first statement will success.$model = Model::where('id', '<>', -1);
if($foo) {
$model->where('id', 1);
}
if($bar) {
$model->where('age', 3);
}
This would work, but it's dirty :(So is it possible to save the Model to a variabel so I don't have to make a static call inside all if statements?
via mimo