Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/brokeyourbike/has-source-model-laravel
Interface for interacting with source models in Laravel
https://github.com/brokeyourbike/has-source-model-laravel
eloquent eloquent-models hacktoberfest interface laravel laravel-8 laravel-8-package php php8
Last synced: 16 days ago
JSON representation
Interface for interacting with source models in Laravel
- Host: GitHub
- URL: https://github.com/brokeyourbike/has-source-model-laravel
- Owner: brokeyourbike
- License: mpl-2.0
- Created: 2021-10-19T14:49:17.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-05-20T11:39:24.000Z (over 1 year ago)
- Last Synced: 2024-12-21T10:52:31.421Z (about 2 months ago)
- Topics: eloquent, eloquent-models, hacktoberfest, interface, laravel, laravel-8, laravel-8-package, php, php8
- Language: PHP
- Homepage:
- Size: 29.3 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# has-source-model
[![Latest Stable Version](https://img.shields.io/github/v/release/brokeyourbike/has-source-model-laravel)](https://github.com/brokeyourbike/has-source-model-laravel/releases)
[![Total Downloads](https://poser.pugx.org/brokeyourbike/has-source-model/downloads)](https://packagist.org/packages/brokeyourbike/has-source-model)
[![Maintainability](https://api.codeclimate.com/v1/badges/a679ea98492b9bd65987/maintainability)](https://codeclimate.com/github/brokeyourbike/has-source-model-laravel/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/a679ea98492b9bd65987/test_coverage)](https://codeclimate.com/github/brokeyourbike/has-source-model-laravel/test_coverage)Interface for interacting with source models.
## Installation
```bash
composer require brokeyourbike/has-source-model
```## Usage
```php
use BrokeYourBike\HasSourceModel\HasSourceModelInterface;
use BrokeYourBike\HasSourceModel\HasSourceModelTrait;class Client implements HasSourceModelInterface
{
use HasSourceModelTrait;public function fetchTransaction(Transaction $transaction)
{
$this->setSourceModel($transaction);
$this->performRequest("transactions/{$transaction->id}");
}private function performRequest(string $url)
{
if ($this->getSourceModel($transaction)) {
// do something with it
}
}
}
```## Authors
- [Ivan Stasiuk](https://github.com/brokeyourbike) | [Twitter](https://twitter.com/brokeyourbike) | [LinkedIn](https://www.linkedin.com/in/brokeyourbike) | [stasi.uk](https://stasi.uk)## License
[Mozilla Public License v2.0](https://github.com/brokeyourbike/has-source-model-laravel/blob/main/LICENSE)