PHP code example of afea / filament-popup

1. Go to this page and download the library: Download afea/filament-popup 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/ */

    

afea / filament-popup example snippets


->plugin(\Afea\Cms\Popup\Filament\PopupPlugin::make())

use Afea\Cms\Popup\Models\Popup;

$popups = Popup::active()
    ->orderBy('order')
    ->get()
    ->filter(fn (Popup $popup) => $popup->matchesPath(request()->path()));

class Popup extends \Afea\Cms\Popup\Models\Popup
{
    public function scopeForLocale(Builder $q, string $locale): Builder
    {
        return $q->whereJsonContains('display_rules->locales', $locale);
    }
}

'models' => ['popup' => \App\Models\Popup::class],