Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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);
}
}
```