Skip to content

Commit 74a1cf4

Browse files
committed
Whitespace and formatting cleanup
1 parent 770b939 commit 74a1cf4

File tree

5 files changed

+27
-23
lines changed

5 files changed

+27
-23
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ Trait for Laravel Eloquent models to allow easy implementation of a "like" or "f
1212

1313
#### Composer Install (for Laravel 5)
1414

15-
composer require rtconner/laravel-likeable "~1.0.7"
15+
composer require rtconner/laravel-likeable "~1.0"
1616

1717
#### Install and then run the migrations
1818

1919
```php
2020
'providers' => array(
21-
'Conner\Likeable\LikeableServiceProvider',
21+
Conner\Likeable\LikeableServiceProvider::class,
2222
);
2323
```
2424

src/Like.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
<?php namespace Conner\Likeable;
1+
<?php
22

3-
use Illuminate\Database\Eloquent\Model as Eloquent;
3+
namespace Conner\Likeable;
44

5-
class Like extends Eloquent {
5+
use Illuminate\Database\Eloquent\Model as Eloquent;
66

7+
class Like extends Eloquent
8+
{
79
protected $table = 'likeable_likes';
810
public $timestamps = true;
911
protected $fillable = ['likable_id', 'likable_type', 'user_id'];

src/LikeCounter.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
<?php namespace Conner\Likeable;
1+
<?php
22

3-
use Illuminate\Database\Eloquent\Model as Eloquent;
3+
namespace Conner\Likeable;
44

5-
class LikeCounter extends Eloquent {
5+
use Illuminate\Database\Eloquent\Model as Eloquent;
66

7+
class LikeCounter extends Eloquent
8+
{
79
protected $table = 'likeable_like_counters';
810
public $timestamps = false;
911
protected $fillable = ['likable_id', 'likable_type', 'count'];

src/LikeableServiceProvider.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
1-
<?php namespace Conner\Likeable;
1+
<?php
2+
3+
namespace Conner\Likeable;
24

35
use Illuminate\Support\ServiceProvider;
46

57
/**
68
* Copyright (C) 2015 Robert Conner
79
*/
8-
class LikeableServiceProvider extends ServiceProvider {
9-
10+
class LikeableServiceProvider extends ServiceProvider
11+
{
1012
protected $defer = true;
1113

12-
public function boot() {
14+
public function boot()
15+
{
1316
$this->publishes([
14-
__DIR__.'/../migrations/2014_09_10_065447_create_likeable_tables.php' => database_path('migrations/2014_09_10_065447_create_likeable_tables.php'),
17+
__DIR__.'/../migrations/2014_09_10_065447_create_likeable_tables.php' => $this->app->databasePath().'/migrations/2014_09_10_065447_create_likeable_tables.php',
1518
]);
1619
}
1720

1821
public function register() {}
1922

20-
public function when() {
23+
public function when()
24+
{
2125
return array('artisan.start');
2226
}
23-
2427
}

src/LikeableTrait.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
<?php namespace Conner\Likeable;
1+
<?php
2+
3+
namespace Conner\Likeable;
24

35
/**
46
* Copyright (C) 2014 Robert Conner
57
*/
6-
7-
trait LikeableTrait {
8-
8+
trait LikeableTrait
9+
{
910
/**
1011
* Fetch only records that currently logged in user has liked/followed
1112
*/
@@ -118,16 +119,12 @@ private function incrementLikeCount()
118119
$counter = $this->likeCounter()->first();
119120

120121
if($counter) {
121-
122122
$counter->count++;
123123
$counter->save();
124-
125124
} else {
126-
127125
$counter = new LikeCounter;
128126
$counter->count = 1;
129127
$this->likeCounter()->save($counter);
130-
131128
}
132129
}
133130

0 commit comments

Comments
 (0)