cmandersen / has-one-specific
Add a Laravel relationship where you can specify a set ID, instead of a dynamic relationship
dev-main
2025-05-09 09:23 UTC
Requires
- php: ^7.3|^8.0
- illuminate/database: ^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0
This package is auto-updated.
Last update: 2026-03-09 10:59:54 UTC
README
Add a Laravel relationship where you can specify a set ID, instead of a dynamic relationship
Installation
composer require cmandersen/has-one-specific
Usage
This package is basically just a trait that uses a relationship class, so it's just a case of using the trait where you need it.
class User extends Model { use \CMAndersen\HasOneSpecific\HasOneSpecific; public function company(){ return $this->hasOneSpecific(Company::class, 97); } }