Skip to content

Commit

Permalink
Merge pull request #83 from Havenstd06/analysis-d0r0bw
Browse files Browse the repository at this point in the history
Apply fixes from StyleCI
  • Loading branch information
Havenstd06 authored Oct 2, 2020
2 parents fdca003 + ff75ee2 commit 0ae6a2c
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 21 deletions.
8 changes: 3 additions & 5 deletions app/Http/Controllers/API/ImageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ public function discover()
->orderBy('created_at', 'DESC')
->jsonPaginate(100);


return response()->json([
'images' => $discover,
'success' => true,
Expand Down Expand Up @@ -187,11 +186,10 @@ public function show(Request $request, $pageName)
->with('user')
->firstOrFail();

if ($image->is_public == ImageStateType::Discover)
{
if ($image->is_public == ImageStateType::Discover) {
return response()->json([
'data' => [
$image
$image,
],
'success' => true,
'status' => 200,
Expand Down Expand Up @@ -222,7 +220,7 @@ public function show(Request $request, $pageName)

return response()->json([
'data' => [
$image
$image,
],
'success' => true,
'status' => 200,
Expand Down
24 changes: 13 additions & 11 deletions app/Http/Controllers/API/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
class UserController extends Controller
{
/**
* Return user private image
* Return user private image.
*
* @param Request $request
* @param $username
Expand Down Expand Up @@ -49,9 +49,10 @@ public function all(Request $request, $username)

return response()->json([
'success' => false,
'error' => "Please enter the API key for user ".$user->username,
'error' => 'Please enter the API key for user '.$user->username,
], 401);
}

/**
* Return user discover image.
*
Expand All @@ -73,12 +74,12 @@ public function discover(Request $request, $username)
return response()->json([
'images' => $discover_images,
'success' => true,
'status' => 200
'status' => 200,
], 200, [], JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT);
}

/**
* Return user public image
* Return user public image.
*
* @param Request $request
* @param $username
Expand Down Expand Up @@ -117,12 +118,12 @@ public function public(Request $request, $username)

return response()->json([
'success' => false,
'error' => "Please enter the API key for user ".$user->username,
'error' => 'Please enter the API key for user '.$user->username,
], 401);
}

/**
* Return user private image
* Return user private image.
*
* @param Request $request
* @param $username
Expand Down Expand Up @@ -161,9 +162,10 @@ public function private(Request $request, $username)

return response()->json([
'success' => false,
'error' => "Please enter the API key for user ".$user->username,
'error' => 'Please enter the API key for user '.$user->username,
], 401);
}

/**
* Return site stats.
*
Expand Down Expand Up @@ -229,13 +231,13 @@ public function user(Request $request, $username)
];

return response()->json([
"stats" => $user_private_stats,
"info" => $user_private_info,
'stats' => $user_private_stats,
'info' => $user_private_info,
], 200, [], JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT);
} else { // Public
return response()->json([
"stats" => $user_stats,
"info" => $user_info,
'stats' => $user_stats,
'info' => $user_info,
], 200, [], JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT);
}
}
Expand Down
3 changes: 1 addition & 2 deletions app/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace App;

use App\Enums\ImageStateType;
use Conner\Likeable\Likeable;
use Illuminate\Database\Eloquent\Model;

Expand All @@ -17,7 +16,7 @@ class Image extends Model
protected $appends = [
'link',
'delete',
'page'
'page',
];

public function user()
Expand Down
2 changes: 1 addition & 1 deletion app/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function getRouteKeyName()
'always_public',
'always_discover',
'created_at',
'updated_at'
'updated_at',
];

/**
Expand Down
2 changes: 0 additions & 2 deletions routes/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

// Stats
use App\Http\Controllers\API\ImageController as APIImageController;
use App\Http\Controllers\API\ImageV2Controller as APIImageV2Controller;
use App\Http\Controllers\API\StatsController as APIStatsController;
use App\Http\Controllers\API\UserController as APIUserController;

Expand All @@ -30,7 +29,6 @@
Route::get('/{username}/images/private', [APIUserController::class, 'private']); // Return private user image
});


// Image OLD
Route::prefix('/images')->group(function () {
Route::get('/discover', [APIImageController::class, 'discover']); // Show public public images
Expand Down

0 comments on commit 0ae6a2c

Please sign in to comment.