laravel-websockets/src/Statistics/Rules/AppId.php

22 lines
593 B
PHP
Raw Normal View History

2018-12-03 12:33:00 +00:00
<?php
namespace BeyondCode\LaravelWebSockets\Statistics\Rules;
use Illuminate\Contracts\Validation\Rule;
2018-12-04 21:22:33 +00:00
use BeyondCode\LaravelWebSockets\Apps\AppProvider;
2018-12-03 12:33:00 +00:00
class AppId implements Rule
{
public function passes($attribute, $value)
{
$appProvider = app(AppProvider::class);
return $appProvider->findById($value) ? true : false;
}
public function message()
{
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 AppProvider returns an app for this id.';
2018-12-04 21:22:33 +00:00
}
}