Files
glastree/app/Models/Comune.php
T
2026-05-26 08:14:29 +02:00

19 lines
448 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Comune extends Model
{
protected $table = 'comuni';
protected $fillable = ['nome', 'codice_istat', 'cap', 'sigla_provincia', 'regione', 'latitudine', 'longitudine'];
public static function search(string $query)
{
return static::where('nome', 'like', "%{$query}%")
->orderBy('nome')
->limit(20)
->get();
}
}