for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Contact extends Model
{
use HasFactory;
protected $guarded = [];
public static function search($search)
return empty($search) ? static::query()
: static::query()->where('id', 'like', '%'.$search.'%')
->orWhere('name', 'like', '%'.$search.'%')
->orWhere('email', 'like', '%'.$search.'%');
}