Skip to content

Commit

Permalink
Laravel 5.8 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
hkp22 committed Mar 19, 2019
1 parent 7d9c4f7 commit a41fdaf
Show file tree
Hide file tree
Showing 26 changed files with 202 additions and 130 deletions.
25 changes: 18 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
language: php

php:
- 7.1
- 7.2
env:
global:
- SETUP=stable

before_script:
- composer self-update
- composer install --prefer-dist --no-interaction
matrix:
fast_finish: true
include:
- php: 7.1
- php: 7.1
env: SETUP=lowest
- php: 7.2
- php: 7.2
env: SETUP=lowest
- php: 7.3

script: ./vendor/bin/phpunit
install:
- if [[ $SETUP = 'stable' ]]; then travis_retry composer update --no-interaction --prefer-stable --no-suggest; fi
- if [[ $SETUP = 'lowest' ]]; then travis_retry composer update --no-interaction --prefer-lowest --prefer-stable --no-suggest; fi

script: vendor/bin/phpunit
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Changelog

All notable changes to `permission` will be documented in this file

## 2.1.0 - 2018-03-16

- Laravel 5.8 compatibility

## 2.0.0 - 2018-12-31

- package namespace changed from Hkp22 to Qirolab.
- package vendor name changed from hkp22 to qirolab. Now to install this package required new command to run `composer require qirolab/laravel-reactions`.


## 1.0.0 - 2018-07-19

- initial release

55 changes: 55 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Contributing

Contributions are **welcome** and will be fully **credited**.

Please read and understand the contribution guide before creating an issue or pull request.

## Etiquette

This project is open source, and as such, the maintainers give their free time to build and maintain the source code
held within. They make the code freely available in the hope that it will be of use to other developers. It would be
extremely unfair for them to suffer abuse or anger for their hard work.

Please be considerate towards maintainers when raising issues or presenting pull requests. Let's show the
world that developers are civilized and selfless people.

It's the duty of the maintainer to ensure that all submissions to the project are of sufficient
quality to benefit the project. Many developers have different skillsets, strengths, and weaknesses. Respect the maintainer's decision, and do not be upset or abusive if your submission is not used.

## Viability

When requesting or submitting new features, first consider whether it might be useful to others. Open
source projects are used by many developers, who may have entirely different needs to your own. Think about
whether or not your feature is likely to be used by other users of the project.

## Procedure

Before filing an issue:

- Attempt to replicate the problem, to ensure that it wasn't a coincidental incident.
- Check to make sure your feature suggestion isn't already present within the project.
- Check the pull requests tab to ensure that the bug doesn't have a fix in progress.
- Check the pull requests tab to ensure that the feature isn't already in progress.

Before submitting a pull request:

- Check the codebase to ensure that your feature doesn't already exist.
- Check the pull requests to ensure that another person hasn't already submitted the feature or fix.

## Requirements

If the project maintainer has any additional requirements, you will find them listed here.

- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](https://pear.php.net/package/PHP_CodeSniffer).

- **Add tests!** - Your patch won't be accepted if it doesn't have tests.

- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date.

- **Consider our release cycle** - We try to follow [SemVer v2.0.0](https://semver.org/). Randomly breaking public APIs is not an option.

- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.

- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](https://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting.

**Happy coding**!
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Laravel Reactions [![GitHub release](https://img.shields.io/github/release/hkp22/laravel-reactions.svg?style=flat-square)](https://github.com/hkp22/laravel-reactions) [![Travis (.org) branch](https://img.shields.io/travis/hkp22/laravel-reactions/master.svg?style=flat-square)](https://github.com/hkp22/laravel-reactions) [![StyleCI](https://github.styleci.io/repos/140428012/shield?branch=master)](https://github.styleci.io/repos/140428012) [![GitHub](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/hkp22/laravel-reactions)
# Laravel Reactions [![GitHub release](https://img.shields.io/github/release/qirolab/laravel-reactions.svg?style=flat-square)](https://github.com/qirolab/laravel-reactions) [![Travis (.org) branch](https://img.shields.io/travis/qirolab/laravel-reactions/master.svg?style=flat-square)](https://github.com/qirolab/laravel-reactions) [![StyleCI](https://github.styleci.io/repos/140428012/shield?branch=master)](https://github.styleci.io/repos/140428012) [![GitHub](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/qirolab/laravel-reactions)

Laravel reactions package for implementing reactions (eg: like, dislike, love, emotion etc) on Eloquent models.

Expand All @@ -7,7 +7,7 @@ Laravel reactions package for implementing reactions (eg: like, dislike, love, e
Download package into the project using Composer.

```bash
$ composer require hkp22/laravel-reactions
$ composer require qirolab/laravel-reactions
```

### Registering package
Expand All @@ -17,15 +17,15 @@ For Laravel 5.4 or earlier releases version include the service provider within

```php
'providers' => [
Hkp22\Laravel\Reactions\ReactionsServiceProvider::class,
Qirolab\Laravel\Reactions\ReactionsServiceProvider::class,
],
```

### Database Migration
If you want to make changes in migrations, publish them to your application first.

```bash
$ php artisan vendor:publish --provider="Hkp22\Laravel\Reactions\ReactionsServiceProvider" --tag=migrations
$ php artisan vendor:publish --provider="Qirolab\Laravel\Reactions\ReactionsServiceProvider" --tag=migrations
```

Run database migrations.
Expand All @@ -36,11 +36,11 @@ $ php artisan migrate
## Usage

### Prepare Reacts (User) Model
Use `Hkp22\Laravel\Reactions\Contracts\ReactsInterface` contract in model which will perform react behavior on reactable model and implement it and use `Hkp22\Laravel\Reactions\Traits\Reacts` trait.
Use `Qirolab\Laravel\Reactions\Contracts\ReactsInterface` contract in model which will perform react behavior on reactable model and implement it and use `Qirolab\Laravel\Reactions\Traits\Reacts` trait.

```php
use Hkp22\Laravel\Reactions\Traits\Reacts;
use Hkp22\Laravel\Reactions\Contracts\ReactsInterface;
use Qirolab\Laravel\Reactions\Traits\Reacts;
use Qirolab\Laravel\Reactions\Contracts\ReactsInterface;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable implements ReactsInterface
Expand All @@ -51,12 +51,12 @@ class User extends Authenticatable implements ReactsInterface

### Prepare Reactable Model

Use `Hkp22\Laravel\Reactions\Contracts\ReactableInterface` contract in model which will get reaction behavior and implement it and use `Hkp22\Laravel\Reactions\Traits\Reactable` trait.
Use `Qirolab\Laravel\Reactions\Contracts\ReactableInterface` contract in model which will get reaction behavior and implement it and use `Qirolab\Laravel\Reactions\Traits\Reactable` trait.

```php
use Illuminate\Database\Eloquent\Model;
use Hkp22\Laravel\Reactions\Traits\Reactable;
use Hkp22\Laravel\Reactions\Contracts\ReactableInterface;
use Qirolab\Laravel\Reactions\Traits\Reactable;
use Qirolab\Laravel\Reactions\Contracts\ReactableInterface;

class Article extends Model implements ReactableInterface
{
Expand Down Expand Up @@ -139,9 +139,9 @@ Article::whereReactedBy($user->id)->get();

### Events

On each reaction added `\Hkp22\Laravel\Reactions\Events\OnReaction` event is fired.
On each reaction added `\Qirolab\Laravel\Reactions\Events\OnReaction` event is fired.

On each reaction removed `\Hkp22\Laravel\Reactions\Events\OnDeleteReaction` event is fired.
On each reaction removed `\Qirolab\Laravel\Reactions\Events\OnDeleteReaction` event is fired.

### Testing

Expand Down
18 changes: 9 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "hkp22/laravel-reactions",
"name": "qirolab/laravel-reactions",
"description": "Implement reactions (like, dislike, love, emotion etc) on Laravel Eloquent models.",
"type": "library",
"license": "MIT",
"keywords": [
"laravel",
"laravel",
"eloquent",
"love",
"like",
Expand All @@ -22,29 +22,29 @@
"authors": [
{
"name": "Harish Kumar",
"email": "harishpra22@gmail.com"
"email": "harish.pra22@gmail.com"
}
],
"require": {
"php": "^7.0",
"illuminate/database": "~5.5|~5.6",
"illuminate/support": "~5.5|~5.6"
"illuminate/database": "~5.5|~5.6|~5.7|~5.8",
"illuminate/support": "~5.5|~5.6|~5.7|~5.8"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.10",
"mockery/mockery": "^1.0",
"orchestra/database": "~3.5.0|~3.6.0",
"orchestra/testbench": "~3.5.0|~3.6.0",
"phpunit/phpunit": "^6.0|^7.0"
"phpunit/phpunit": "^7.0"
},
"autoload": {
"psr-4": {
"Hkp22\\Laravel\\Reactions\\": "src/"
"Qirolab\\Laravel\\Reactions\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Hkp22\\Tests\\Laravel\\Reactions\\": "tests/"
"Qirolab\\Tests\\Laravel\\Reactions\\": "tests/"
}
},
"scripts": {
Expand All @@ -56,7 +56,7 @@
"extra": {
"laravel": {
"providers": [
"Hkp22\\Laravel\\Reactions\\ReactionsServiceProvider"
"Qirolab\\Laravel\\Reactions\\ReactionsServiceProvider"
]
}
},
Expand Down
2 changes: 1 addition & 1 deletion src/Contracts/ReactableInterface.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Hkp22\Laravel\Reactions\Contracts;
namespace Qirolab\Laravel\Reactions\Contracts;

interface ReactableInterface
{
Expand Down
2 changes: 1 addition & 1 deletion src/Contracts/ReactsInterface.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Hkp22\Laravel\Reactions\Contracts;
namespace Qirolab\Laravel\Reactions\Contracts;

interface ReactsInterface
{
Expand Down
18 changes: 9 additions & 9 deletions src/Events/OnDeleteReaction.php
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
<?php

namespace Hkp22\Laravel\Reactions\Events;
namespace Qirolab\Laravel\Reactions\Events;

use Hkp22\Laravel\Reactions\Models\Reaction;
use Hkp22\Laravel\Reactions\Contracts\ReactsInterface;
use Hkp22\Laravel\Reactions\Contracts\ReactableInterface;
use Qirolab\Laravel\Reactions\Models\Reaction;
use Qirolab\Laravel\Reactions\Contracts\ReactsInterface;
use Qirolab\Laravel\Reactions\Contracts\ReactableInterface;

class OnDeleteReaction
{
/**
* The reactable model.
*
* @var \Hkp22\Laravel\Reactions\Traits\Reactable
* @var \Qirolab\Laravel\Reactions\Traits\Reactable
*/
public $reactable;

/**
* User who reacted on model.
*
* @var \Hkp22\Laravel\Reactions\Traits\Reacts
* @var \Qirolab\Laravel\Reactions\Traits\Reacts
*/
public $reactBy;

/**
* Reaction model.
*
* @var \Hkp22\Laravel\Reactions\Models\Reaction
* @var \Qirolab\Laravel\Reactions\Models\Reaction
*/
public $reaction;

/**
* Create a new event instance.
*
* @param \Hkp22\Laravel\Reactions\Traits\Reactable $reactable
* @param \Hkp22\Laravel\Reactions\Traits\Reacts $reactBy
* @param \Qirolab\Laravel\Reactions\Traits\Reactable $reactable
* @param \Qirolab\Laravel\Reactions\Traits\Reacts $reactBy
* @return void
*/
public function __construct(ReactableInterface $reactable, Reaction $reaction, ReactsInterface $reactBy)
Expand Down
18 changes: 9 additions & 9 deletions src/Events/OnReaction.php
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
<?php

namespace Hkp22\Laravel\Reactions\Events;
namespace Qirolab\Laravel\Reactions\Events;

use Hkp22\Laravel\Reactions\Models\Reaction;
use Hkp22\Laravel\Reactions\Contracts\ReactsInterface;
use Hkp22\Laravel\Reactions\Contracts\ReactableInterface;
use Qirolab\Laravel\Reactions\Models\Reaction;
use Qirolab\Laravel\Reactions\Contracts\ReactsInterface;
use Qirolab\Laravel\Reactions\Contracts\ReactableInterface;

class OnReaction
{
/**
* The reactable model.
*
* @var \Hkp22\Laravel\Reactions\Traits\Reactable
* @var \Qirolab\Laravel\Reactions\Traits\Reactable
*/
public $reactable;

/**
* User who reacted on model.
*
* @var \Hkp22\Laravel\Reactions\Traits\Reacts
* @var \Qirolab\Laravel\Reactions\Traits\Reacts
*/
public $reactBy;

/**
* Reaction model.
*
* @var \Hkp22\Laravel\Reactions\Models\Reaction
* @var \Qirolab\Laravel\Reactions\Models\Reaction
*/
public $reaction;

/**
* Create a new event instance.
*
* @param \Hkp22\Laravel\Reactions\Traits\Reactable $reactable
* @param \Hkp22\Laravel\Reactions\Traits\Reacts $reactBy
* @param \Qirolab\Laravel\Reactions\Traits\Reactable $reactable
* @param \Qirolab\Laravel\Reactions\Traits\Reacts $reactBy
* @return void
*/
public function __construct(ReactableInterface $reactable, Reaction $reaction, ReactsInterface $reactBy)
Expand Down
2 changes: 1 addition & 1 deletion src/Exceptions/InvalidReactionUser.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Hkp22\Laravel\Reactions\Exceptions;
namespace Qirolab\Laravel\Reactions\Exceptions;

use Exception;

Expand Down
2 changes: 1 addition & 1 deletion src/Models/Reaction.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Hkp22\Laravel\Reactions\Models;
namespace Qirolab\Laravel\Reactions\Models;

use Illuminate\Database\Eloquent\Model;

Expand Down
2 changes: 1 addition & 1 deletion src/ReactionsServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Hkp22\Laravel\Reactions;
namespace Qirolab\Laravel\Reactions;

use Illuminate\Support\ServiceProvider;

Expand Down
Loading

0 comments on commit a41fdaf

Please sign in to comment.