use BeyondCode\LaravelWebSockets\Contracts\AppManager;
6
use Illuminate\Contracts\Validation\Rule;
7
8
class AppId implements Rule
9
{
10
/**
11
* Create a new rule.
12
*
13
* @param mixed $attribute
14
* @param mixed $value
15
* @return bool
16
*/
17
public function passes($attribute, $value)
18
{
19
$manager = app(AppManager::class);
20
21
return $manager->findById($value) ? true : false;
22
}
23
24
/**
25
* The validation message.
26
*
27
* @return string
28
*/
29
public function message()
30
{
31
return 'There is no app registered with the given id. Make sure the websockets config file contains an app for this id or that your custom AppManager returns an app for this id.';