https://github.com/cmandersen/has-one-specific
Add a Laravel relationship where you can specify a set ID, instead of a dynamic relationship
https://github.com/cmandersen/has-one-specific
Last synced: 8 months ago
JSON representation
Add a Laravel relationship where you can specify a set ID, instead of a dynamic relationship
- Host: GitHub
- URL: https://github.com/cmandersen/has-one-specific
- Owner: cmandersen
- Created: 2021-06-16T11:20:56.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2024-05-24T10:02:57.000Z (about 2 years ago)
- Last Synced: 2025-02-28T19:38:01.552Z (over 1 year ago)
- Language: PHP
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# HasOneSpecific
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.
```php
class User extends Model {
use \CMAndersen\HasOneSpecific\HasOneSpecific;
public function company(){
return $this->hasOneSpecific(Company::class, 97);
}
}
```