Skip to content

Commit 15ddb66

Browse files
committed
Fix StyleCi errors
1 parent 12cfbc0 commit 15ddb66

File tree

10 files changed

+22
-38
lines changed

10 files changed

+22
-38
lines changed

app/Exceptions/CannotLikeReplyTwice.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,4 @@
66

77
class CannotLikeReplyTwice extends Exception
88
{
9-
109
}

app/Helpers/HasLikes.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
namespace App\Helpers;
44

5-
use App\Models\Like;
65
use App\User;
6+
use App\Models\Like;
77

88
trait HasLikes
99
{
1010
protected static function bootHasLikes()
1111
{
12-
static::deleting(function ($model){
12+
static::deleting(function ($model) {
1313
$model->likes->each->delete();
1414
});
1515
}
@@ -31,12 +31,15 @@ public function likes()
3131

3232
public function isLikedBy(User $user)
3333
{
34-
if ($user == null) return false;
34+
if ($user == null) {
35+
return false;
36+
}
37+
3538
return $this->likes()->where('user_id', $user->id)->exists();
3639
}
3740

3841
public function getLikesCountAttribute()
3942
{
4043
return $this->likes->count();
4144
}
42-
}
45+
}

app/Http/Controllers/ReplyController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
namespace App\Http\Controllers;
44

5-
use App\Jobs\DislikeReply;
6-
use App\Jobs\LikeReply;
75
use App\Models\Reply;
86
use App\Models\Thread;
7+
use App\Jobs\LikeReply;
98
use App\Jobs\CreateReply;
109
use App\Jobs\DeleteReply;
1110
use App\Jobs\UpdateReply;
1211
use App\Models\ReplyAble;
12+
use App\Jobs\DislikeReply;
1313
use App\Policies\ReplyPolicy;
1414
use Illuminate\Http\RedirectResponse;
1515
use App\Http\Requests\CreateReplyRequest;

app/Jobs/DislikeReply.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,11 @@
22

33
namespace App\Jobs;
44

5-
use App\Models\Reply;
65
use App\User;
7-
use Illuminate\Bus\Queueable;
8-
use Illuminate\Queue\SerializesModels;
9-
use Illuminate\Queue\InteractsWithQueue;
10-
use Illuminate\Contracts\Queue\ShouldQueue;
11-
use Illuminate\Foundation\Bus\Dispatchable;
6+
use App\Models\Reply;
127

13-
class DislikeReply implements ShouldQueue
8+
class DislikeReply
149
{
15-
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
16-
1710
/**
1811
* @var \App\Models\Reply
1912
*/

app/Jobs/LikeReply.php

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,13 @@
22

33
namespace App\Jobs;
44

5-
use App\Exceptions\CannotLikeReplyTwice;
6-
use App\Models\Reply;
75
use App\User;
8-
use Illuminate\Bus\Queueable;
6+
use App\Models\Reply;
97
use Illuminate\Database\QueryException;
10-
use Illuminate\Queue\SerializesModels;
11-
use Illuminate\Queue\InteractsWithQueue;
12-
use Illuminate\Contracts\Queue\ShouldQueue;
13-
use Illuminate\Foundation\Bus\Dispatchable;
8+
use App\Exceptions\CannotLikeReplyTwice;
149

15-
class LikeReply implements ShouldQueue
10+
class LikeReply
1611
{
17-
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
18-
1912
/**
2013
* @var \App\Models\Reply
2114
*/

app/Models/Reply.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,16 @@
22

33
namespace App\Models;
44

5-
use App\Helpers\HasAuthor;
65
use App\Helpers\HasLikes;
6+
use App\Helpers\HasAuthor;
77
use App\Helpers\ModelHelpers;
88
use App\Helpers\HasTimestamps;
99
use Illuminate\Database\Eloquent\Model;
1010
use Illuminate\Database\Eloquent\Relations\MorphTo;
1111

1212
class Reply extends Model
1313
{
14-
use HasLikes,
15-
HasAuthor, HasTimestamps, ModelHelpers;
14+
use HasLikes, HasAuthor, HasTimestamps, ModelHelpers;
1615

1716
/**
1817
* {@inheritdoc}

database/migrations/2017_12_03_111900_create_likes_table.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function up()
2020
$table->string('liked_type');
2121
$table->timestamps();
2222

23-
$table->unique(['user_id', 'liked_id' , 'liked_type']);
23+
$table->unique(['user_id', 'liked_id', 'liked_type']);
2424
});
2525
}
2626

tests/Components/Jobs/DislikeReplyTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
namespace Tests\Components\Jobs;
44

5-
use App\Jobs\DislikeReply;
6-
use App\Models\Reply;
75
use App\User;
86
use Tests\TestCase;
7+
use App\Models\Reply;
8+
use App\Jobs\DislikeReply;
99
use Illuminate\Foundation\Testing\DatabaseMigrations;
1010

1111
class DislikeReplyTest extends TestCase

tests/Components/Jobs/LikeReplyTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
namespace Tests\Components\Jobs;
44

5-
use App\Exceptions\CannotLikeReplyTwice;
6-
use App\Jobs\LikeReply;
7-
use App\Models\Reply;
85
use App\User;
96
use Tests\TestCase;
7+
use App\Models\Reply;
8+
use App\Jobs\LikeReply;
9+
use App\Exceptions\CannotLikeReplyTwice;
1010
use Illuminate\Foundation\Testing\DatabaseMigrations;
1111

1212
class LikeReplyTest extends TestCase

tests/Components/Models/ReplyTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,8 @@
22

33
namespace Tests\Components\Models;
44

5-
use Carbon\Carbon;
6-
use Illuminate\Support\Facades\Auth;
75
use Tests\TestCase;
86
use App\Models\Reply;
9-
use App\Models\User;
107
use Illuminate\Foundation\Testing\DatabaseMigrations;
118

129
class ReplyTest extends TestCase

0 commit comments

Comments
 (0)