S
$section->users()->attach($request->user_id);
Size: a a a
S
AW
AP
ДК
ДК
ДК
V
A
V
V
V
V
V
A
post_id | tag_id
public function tags()
{
return $this->belongsToMany('App\Tag');
}
public function posts()
{
return $this->belongsToMany('App\Post');
}
$model_post->with('tags')->get();
V
post_id | tag_id
public function tags()
{
return $this->belongsToMany('App\Tag');
}
public function posts()
{
return $this->belongsToMany('App\Post');
}
$model_post->with('tags')->get();
С
K
$categories->keyBy('id')???
ЕК
public function __construct(Service $service)
{
$this->service = $service;
}
Есть сервисный классpublic function __construct(Client $client)
{
$this->client = $client;
}
И есть провайдерpublic function register()
{
$this->app->bind(Service::class, function () {
$url = config('some_url');
$client = new Client([
'base_uri' => $url,
'auth'=>['login','password']
]);
return new Service($client);
});
}
ЕК