30 lines
585 B
PHP
30 lines
585 B
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use Illuminate\Support\ServiceProvider;
|
|
use Illuminate\Database\Eloquent\Builder;
|
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* Register any application services.
|
|
*/
|
|
public function register(): void
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Bootstrap any application services.
|
|
*/
|
|
public function boot(): void
|
|
{
|
|
// Search
|
|
Builder::macro('search', function ($field, $string) {
|
|
return $string ? $this->where($field, 'like', '%' . $string . '%') : $this;
|
|
});
|
|
|
|
}
|
|
}
|