<?php

namespace LaraBB\Forum\Tasks\Permission;

use Illuminate\Database\Eloquent\Collection;
use LaraBB\Forum\Models\Forum;

/**
 * Class StoreForumPermissionsTask
 * @package LaraBB\Forum\Tasks
 */
class StoreTask
{
    /**
     * @param Forum $forum
     * @param $data
     * @return bool|Collection
     */
    public function run(Forum $forum, $data): Collection|bool
    {
        return empty($data) ? true : $forum->permissions()->createMany($data);
    }
}
