Add more API resources; user bid management and tests #35 #36

This commit is contained in:
Nabeel Shahzad
2017-12-12 16:58:27 -06:00
parent 5b25a464ba
commit 248a8d1488
27 changed files with 470 additions and 166 deletions

View File

@@ -6,7 +6,6 @@
namespace App\Http\Middleware;
use Auth;
use Cache;
use Closure;
use App\Models\User;
@@ -28,16 +27,8 @@ class ApiAuth
// Try to find the user via API key. Cache this lookup
$api_key = $request->header('Authorization');
$user = User::where('apikey', $api_key)->first();
/*$user = Cache::remember(
config('cache.keys.USER_API_KEY.key') . $api_key,
config('cache.keys.USER_API_KEY.time'),
function () use ($api_key) {
return User::where('apikey', $api_key)->first();
}
);*/
if(!$user) {
$user = User::where('api_key', $api_key)->first();
if($user === null) {
return $this->unauthorized();
}