mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-18 18:13:11 +00:00
* composer fix-style * feat(model): add support for new Scope attribute * composer fix-style * snapshot * check if class_exists for psalm * check if class_exists for psalm * resolve psalm issue * remove prefix slash * revert whitespace changes * composer fix-style * Update composer.json --------- Co-authored-by: laravel-ide-helper <[email protected]> Co-authored-by: Barry vd. Heuvel <[email protected]>
34 lines
746 B
PHP
34 lines
746 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\QueryScopes\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Attributes\Scope;
|
|
use Illuminate\Database\Eloquent\Builder;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Comment extends Model
|
|
{
|
|
/**
|
|
* @comment Scope using the 'Scope' attribute
|
|
* @param Builder $query
|
|
* @return void
|
|
*/
|
|
#[Scope]
|
|
protected function local(Builder $query): void
|
|
{
|
|
$query->where('ip_address', '127.0.0.1');
|
|
}
|
|
|
|
/**
|
|
* @comment Scope using the 'scope' prefix
|
|
* @param Builder $query
|
|
* @return void
|
|
*/
|
|
protected function scopeSystem(Builder $query): void
|
|
{
|
|
$query->where('system', true);
|
|
}
|
|
}
|