$job_id
но нигде его не используешь.// User model
public function jobs()
{
return $this->belongsToMany('App\Job', 'job_applies');
}
public function applied($job_id)
{
return $this->jobs()->where('job_id', $job_id)->count() > 0;
}
$user->properties
это magic __get
, который возвращает новый объект, поэтому его изменения не затронут саму модель.$user = User::find(1);
$temp = $user->properties;
$temp->role = 'admin';
$user->properties = $temp;
$user->save();
Route::get('{any}', function() {
return view('angular');
})->where('any', '.*');
$view = View::make('master', ['key' => 'value']);
$html = $view->render();
$a_models = collect([]);
$list_of_b_models = $modelB->whereIn('id', [1,2,3])->with('relationA')->get();
forEach($list_of_b_models as $model_b) {
$a_models = $a_models->merge($model_b->relationA);
}
User::find(1)->blogs()->with('topics')->paginate(10)
public function short () {
return $this->hasMany('Site', 'owner', 'login');
}
'attributes' => [
'FieldName' => '',
],
{{Form::model($tariff, ['method' => 'PATCH', 'route' => ['tariffs.update', $tariff->id]])}}
{{ Form::text('salary', isset($tariff) ? formatRubles($tariff->salary) : null, ['class' => 'form-control']) }}
{{Form::close()}}