Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 11 days 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 (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-05-24T10:02:57.000Z (6 months ago)
- Last Synced: 2024-11-05T23:43:05.799Z (13 days 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);
}
}
```