1. Go to this page and download the library: Download baspa/filament-canary library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
baspa / filament-canary example snippets
use Baspa\FilamentCanary\Testing\InteractsWithCanary;
uses(InteractsWithCanary::class);
it('every Filament page mounts and authorizes', function () {
$this->canarySweep();
});
public function canAccessPanel(Panel $panel): bool
{
return session()->has('user') && session()->has('loginToken'); // Canary can't satisfy this by default
}
// e.g. in a test's setUp() or a service provider
use Baspa\FilamentCanary\Sweep\Requester;
$this->app->bind(Requester::class, MyRequester::class);
use Baspa\FilamentCanary\Sweep\Requester;
use Illuminate\Contracts\Auth\Authenticatable;
class MyRequester implements Requester
{
public function get(string $url, ?Authenticatable $user, string $guard): int
{
// establish whatever state the panel's gate