Repositories
Creation of a repository
class ThreadRepository implements ThreadRepositoryInterface
{
public function storeThread(string $name, string $status, string|null $description, string $color, int $channelId)
{
$thread = Thread::create([
'name' => $name,
'status' => $status,
'description' => $description,
'color' => $color,
'channel_id' => $channelId
]);
return $thread;
}
public function updateThread(Thread $thread, string $name, string $status, string|null $description, string $color, int $channelId)
{
$thread->update([
'name' => $name,
'status' => $status,
'description' => $description,
'color' => $color,
'channel_id' => $channelId
]);
return $thread;
}
public function destroyThread(Thread $thread)
{
$thread->delete();
}
}Last updated