一键导入
laragear-rut-eloquent
Manage Chilean RUTs in Eloquent models with custom casting and scopes.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Manage Chilean RUTs in Eloquent models with custom casting and scopes.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | laragear-rut-eloquent |
| description | Manage Chilean RUTs in Eloquent models with custom casting and scopes. |
Use this skill when storing, casting, or querying Chilean RUT attributes inside Eloquent models.
Locate the model that will use RUTs and add the Laragear\Rut\HasRut trait.
use Illuminate\Database\Eloquent\Model;
use Laragear\Rut\HasRut;
class User extends Model
{
use HasRut;
// ...
}
Ensure the Model migration contains the RUT columns:
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up()
{
Schema::create('users', function (Blueprint $table) {
// ...
$table->rut(); // Add the RUT number and verification digit columns
// ...
});
}
}
Cast database strings automatically into Rut value objects for formatting helpers.
use Laragear\Rut\Casts\CastRut;
protected function casts()
{
return [
'rut' => CastRut::class,
];
}
When using the Laragear\Rut\HasRut trait in the model, the model query builder will have access to many RUT Local Scopes. Read that trait PHPDoc for a list of available methods.
use App\Models\User;
$user = User::findByRut('15.518.258-K');