Skip to content

Commit f9fe6dc

Browse files
committed
Initial commit.
0 parents  commit f9fe6dc

26 files changed

+936
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
vendor/
2+
composer.lock

.styleci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
preset: laravel

.travis.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
language: php
2+
3+
php:
4+
- 7.1
5+
- 7.2
6+
7+
env:
8+
matrix:
9+
- COMPOSER_FLAGS=""
10+
11+
before_script:
12+
- travis_retry composer self-update
13+
- travis_retry composer update ${COMPOSER_FLAGS} --no-interaction --prefer-source
14+
15+
script:
16+
- phpunit --coverage-text --coverage-clover=coverage.xml
17+
18+
after_success:
19+
- bash <(curl -s https://codecov.io/bash)

codecov.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
codecov:
2+
notify:
3+
require_ci_to_pass: yes
4+
5+
coverage:
6+
precision: 2
7+
round: down
8+
range: “70…100”
9+
10+
status:
11+
project: yes
12+
patch: yes
13+
changes: no
14+
15+
comment:
16+
layout: “reach, diff, flags, files, footer”
17+
behavior: default
18+
require_changes: no

composer.json

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{
2+
"name": "rennokki/rating",
3+
"description": "Laravel Eloquent Rating is a simple rating system which can be implemented on any model.",
4+
"keywords": [
5+
"eloquent",
6+
"laravel",
7+
"model",
8+
"rating",
9+
"rate",
10+
"stars",
11+
"star",
12+
"system"
13+
],
14+
"homepage": "https://github.com/rennokki/rating",
15+
"license": "MIT",
16+
"authors": [
17+
{
18+
"name": "Alex Renoki",
19+
"email": "rennokki@gmail.com",
20+
"homepage": "https://twitter.com/rennokki",
21+
"role": "Developer"
22+
}
23+
],
24+
"require": {
25+
"illuminate/config": "~5.5.0|~5.6.0",
26+
"illuminate/database": "~5.5.0|~5.6.0",
27+
"illuminate/contracts": "~5.5.0|~5.6.0",
28+
"illuminate/support": "~5.5.0|~5.6.0",
29+
"illuminate/http": "~5.5.0|~5.6.0",
30+
"illuminate/auth": "~5.5.0|~5.6.0"
31+
},
32+
"require-dev": {
33+
"phpunit/phpunit": "^6.2|^7.0",
34+
"orchestra/testbench": "~3.5.0|~3.6.0",
35+
"orchestra/database": "~3.5.0|~3.6.0"
36+
},
37+
"autoload": {
38+
"psr-4": {
39+
"Rennokki\\Rating\\": "src"
40+
}
41+
},
42+
"autoload-dev": {
43+
"psr-4": {
44+
"Rennokki\\Rating\\Test\\": "tests"
45+
}
46+
},
47+
"scripts": {
48+
"test": "vendor/bin/phpunit"
49+
},
50+
"extra": {
51+
"laravel": {
52+
"providers": [
53+
"Rennokki\\Rating\\RatingServiceProvider"
54+
]
55+
}
56+
},
57+
"config": {
58+
"sort-packages": true
59+
},
60+
"minimum-stability": "dev"
61+
}

config/rating.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
return [
4+
5+
/*
6+
* The models for rating tables.
7+
*/
8+
9+
'models' => [
10+
'rating' => \Rennokki\Rating\Models\RatingModel::class,
11+
],
12+
13+
];

database/factories/PageFactory.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
/*
3+
|--------------------------------------------------------------------------
4+
| Model Factories
5+
|--------------------------------------------------------------------------
6+
|
7+
| This directory should contain each of the model factory definitions for
8+
| your application. Factories provide a convenient way to generate new
9+
| model instances for testing / seeding your application's database.
10+
|
11+
*/
12+
13+
$factory->define(\Rennokki\Rating\Test\Models\Page::class, function () {
14+
return [
15+
'name' => 'Page'.str_random(5),
16+
];
17+
});
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
/*
3+
|--------------------------------------------------------------------------
4+
| Model Factories
5+
|--------------------------------------------------------------------------
6+
|
7+
| This directory should contain each of the model factory definitions for
8+
| your application. Factories provide a convenient way to generate new
9+
| model instances for testing / seeding your application's database.
10+
|
11+
*/
12+
13+
$factory->define(\Rennokki\Rating\Test\Models\SimplePage::class, function () {
14+
return [
15+
'name' => 'Page'.str_random(5),
16+
];
17+
});

database/factories/UserFactory.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
/*
3+
|--------------------------------------------------------------------------
4+
| Model Factories
5+
|--------------------------------------------------------------------------
6+
|
7+
| This directory should contain each of the model factory definitions for
8+
| your application. Factories provide a convenient way to generate new
9+
| model instances for testing / seeding your application's database.
10+
|
11+
*/
12+
13+
$factory->define(\Rennokki\Rating\Test\Models\User::class, function () {
14+
return [
15+
'name' => 'Name'.str_random(5),
16+
'email' => str_random(5).'@gmail.com',
17+
'password' => '$2y$10$TKh8H1.PfQx37YgCzwiKb.KjNyWgaHb9cbcoQgdIVFlYg7B77UdFm', // secret
18+
'remember_token' => str_random(10),
19+
];
20+
});
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
use Illuminate\Support\Facades\Schema;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Database\Migrations\Migration;
6+
7+
class Ratings extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::create('ratings', function (Blueprint $table) {
17+
$table->increments('id');
18+
19+
$table->integer('rateable_id');
20+
$table->string('rateable_type');
21+
22+
$table->integer('rater_id')->nullable();
23+
$table->string('rater_type')->nullable();
24+
25+
$table->float('rating', 9, 2);
26+
27+
$table->timestamps();
28+
});
29+
}
30+
31+
/**
32+
* Reverse the migrations.
33+
*
34+
* @return void
35+
*/
36+
public function down()
37+
{
38+
Schema::dropIfExists('ratings');
39+
}
40+
}

0 commit comments

Comments
 (0)