31 lines
572 B
PHP
31 lines
572 B
PHP
<?php
|
|
|
|
namespace LaraBB\Invite\Tasks;
|
|
|
|
use LaraBB\Invite\Models\Invite;
|
|
|
|
/**
|
|
* Class GetInviteTask
|
|
* @package LaraBB\Invite\Tasks
|
|
*/
|
|
class FindTask
|
|
{
|
|
/**
|
|
* GetInviteTask constructor.
|
|
* @param Invite $invite
|
|
*/
|
|
public function __construct(private readonly Invite $invite)
|
|
{
|
|
}
|
|
|
|
/**
|
|
* @param string $code
|
|
* @param array $with
|
|
* @return Invite
|
|
*/
|
|
public function byCode(string $code, array $with = []): Invite
|
|
{
|
|
return $this->invite->query()->with($with)->where('code', $code)->get()->first();
|
|
}
|
|
}
|