Apply fixes from StyleCI (#18) [skip ci]

This pull request applies code style fixes from an analysis carried out by [StyleCI](https://github.styleci.io).

---

For more information, click [here](https://github.styleci.io/analyses/zYNYDd).
This commit is contained in:
Pig Fang 2019-03-15 00:03:54 +08:00 committed by GitHub
parent 5915b3ec17
commit 1afa36e8e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 3 deletions

View File

@ -40,8 +40,9 @@ class MigrateCloset extends Command
*/
public function handle()
{
if (!Schema::hasTable('closets')) {
if (! Schema::hasTable('closets')) {
$this->info('Nothing to do.');
return;
}

View File

@ -45,6 +45,7 @@ class ClosetController extends Controller
// Pagination
$items = $closet->get()->map(function ($t) {
$t->name = $t->pivot->item_name;
return $t;
});
$totalPages = ceil($items->count() / $perPage);
@ -98,6 +99,7 @@ class ClosetController extends Controller
}
$user->closet()->updateExistingPivot($request->tid, ['item_name' => $request->new_name]);
return json(trans('user.closet.rename.success', ['name' => $request->new_name]), 0);
}

View File

@ -211,6 +211,7 @@ class SkinlibController extends Controller
$user->setScore($cost, 'minus');
$user->closet()->attach($t->tid, ['item_name' => $t->name]);
return json(trans('skinlib.upload.success', ['name' => $request->input('name')]), 0, [
'tid' => $t->tid,
]);

View File

@ -318,6 +318,7 @@ class User extends Authenticatable
public function delete()
{
Player::where('uid', $this->uid)->delete();
return parent::delete();
}

View File

@ -272,7 +272,7 @@ class SkinlibControllerTest extends TestCase
])
->decodeResponseJson('items');
$this->assertTrue(collect($items)->every(function ($item) {
return !$item['liked'];
return ! $item['liked'];
}));
// A user has added a texture from skin library to his closet
@ -281,7 +281,7 @@ class SkinlibControllerTest extends TestCase
$this->getJson('/skinlib/data')
->assertJson([
'items' => [
['tid' => $texture->tid, 'liked' => true]
['tid' => $texture->tid, 'liked' => true],
],
'current_uid' => $otherUser->uid,
'total_pages' => 2,