Perhaps if you add more lines to the comments, and make each line 3 characters shorter than the previous.
Apr 15, 2017
4
Level 33
A more Laravel way
Hello,
What would be more the laravel way of doing this?:
/**
* Subscribe to a forum
*
* @param Forum $forum
* @return bool
*/
public function subscribe(Forum $forum, $user)
{
$subscription = new Subscription;
$subscription->user_id = $user->id;
$forum->subscriptions()->save($subscription);
}
The relation between forum and subscription is like this:
/**
* @return mixed
*/
public function subscriptions()
{
return $this->morphMany(Subscription::class, 'subscription');
}
Please or to participate in this conversation.