Code formatting

pull/20/head
Hasin Hayder 2 years ago
parent 562306a1b9
commit be7d9b8a46

@ -51,15 +51,15 @@ class Handler extends ExceptionHandler {
public function render($request, Throwable $exception) { public function render($request, Throwable $exception) {
if ($exception instanceof ModelNotFoundException) { if ($exception instanceof ModelNotFoundException) {
return response([ return response([
'error'=>1, 'error' => 1,
'message'=>$exception->getMessage(), 'message' => $exception->getMessage(),
], 404); ], 404);
} }
if ($exception instanceof MissingAbilityException) { if ($exception instanceof MissingAbilityException) {
return response([ return response([
'error'=>1, 'error' => 1,
'message'=>'Not authorized', 'message' => 'Not authorized',
], 409); ], 409);
} }

@ -5,13 +5,13 @@ namespace App\Http\Controllers;
class HydraController extends Controller { class HydraController extends Controller {
public function hydra() { public function hydra() {
return response([ return response([
'message'=>'Welcome to Hydra, the zero config API boilerplate with roles and abilities for Laravel Sanctum. Please visit https://hasinhayder.github.io/hydra to know more.', 'message' => 'Welcome to Hydra, the zero config API boilerplate with roles and abilities for Laravel Sanctum. Please visit https://hasinhayder.github.io/hydra to know more.',
]); ]);
} }
public function version() { public function version() {
return response([ return response([
'version'=> config('hydra.version'), 'version' => config('hydra.version'),
]); ]);
} }
} }

@ -20,8 +20,8 @@ class HydraLog {
public function terminate($request, $response) { public function terminate($request, $response) {
Log::info("\n\n".str_repeat('=', 100)."\n\n"); Log::info("\n\n".str_repeat('=', 100)."\n\n");
Log::debug('app.route', ['route'=>$request->route()]); Log::debug('app.route', ['route' => $request->route()]);
Log::debug('app.headers', ['headers'=>$request->headers]); Log::debug('app.headers', ['headers' => $request->headers]);
Log::debug('app.requests', ['request' => $request->all()]); Log::debug('app.requests', ['request' => $request->all()]);
Log::debug('app.response', ['response' => $response]); Log::debug('app.response', ['response' => $response]);
Log::info("\n\n".str_repeat('=', 100)."\n\n"); Log::info("\n\n".str_repeat('=', 100)."\n\n");

@ -21,9 +21,9 @@ class UsersSeeder extends Seeder {
Schema::enableForeignKeyConstraints(); Schema::enableForeignKeyConstraints();
$user = User::create([ $user = User::create([
'email'=>'admin@hydra.project', 'email' => 'admin@hydra.project',
'password'=>Hash::make('hydra'), 'password' => Hash::make('hydra'),
'name'=>'Hydra Admin', 'name' => 'Hydra Admin',
]); ]);
$user->roles()->attach(Role::where('slug', 'admin')->first()); $user->roles()->attach(Role::where('slug', 'admin')->first());
} }

@ -13,8 +13,8 @@ class AdminLoginTest extends TestCase {
*/ */
public function test_admin_login() { public function test_admin_login() {
$response = $this->postJson('/api/login', [ $response = $this->postJson('/api/login', [
'email'=>'admin@hydra.project', 'email' => 'admin@hydra.project',
'password'=>'hydra', 'password' => 'hydra',
]); ]);
$response $response
@ -26,8 +26,8 @@ class AdminLoginTest extends TestCase {
public function test_admin_login_fail() { public function test_admin_login_fail() {
$response = $this->postJson('/api/login', [ $response = $this->postJson('/api/login', [
'email'=>'admin@hydra.project', 'email' => 'admin@hydra.project',
'password'=>'hydrax', 'password' => 'hydrax',
]); ]);
$response $response

@ -49,7 +49,7 @@ class RoleTest extends TestCase {
$response = $this->withHeader('Authorization', 'Bearer '.$this->token) $response = $this->withHeader('Authorization', 'Bearer '.$this->token)
->put('/api/roles/4', [ ->put('/api/roles/4', [
'name'=>'Chief Editor', 'name' => 'Chief Editor',
]); ]);
$response $response
@ -72,7 +72,7 @@ class RoleTest extends TestCase {
$response = $this->withHeader('Authorization', 'Bearer '.$this->token) $response = $this->withHeader('Authorization', 'Bearer '.$this->token)
->put('/api/roles/4', [ ->put('/api/roles/4', [
'slug'=>'chief-editor', 'slug' => 'chief-editor',
]); ]);
$response $response
@ -95,8 +95,8 @@ class RoleTest extends TestCase {
$response = $this->withHeader('Authorization', 'Bearer '.$this->token) $response = $this->withHeader('Authorization', 'Bearer '.$this->token)
->put('/api/roles/4', [ ->put('/api/roles/4', [
'name'=>'Editor X', 'name' => 'Editor X',
'slug'=>'editor-x', 'slug' => 'editor-x',
]); ]);
$response $response
@ -120,7 +120,7 @@ class RoleTest extends TestCase {
$response = $this->withHeader('Authorization', 'Bearer '.$this->token) $response = $this->withHeader('Authorization', 'Bearer '.$this->token)
->put('/api/roles/1', [ ->put('/api/roles/1', [
'slug'=>'admin-x', 'slug' => 'admin-x',
]); ]);
$response $response
@ -143,8 +143,8 @@ class RoleTest extends TestCase {
$response = $this->withHeader('Authorization', 'Bearer '.$this->token) $response = $this->withHeader('Authorization', 'Bearer '.$this->token)
->post('/api/roles', [ ->post('/api/roles', [
'name'=>'New Role', 'name' => 'New Role',
'slug'=>'new-role', 'slug' => 'new-role',
]); ]);
$response $response
@ -168,8 +168,8 @@ class RoleTest extends TestCase {
$response = $this->withHeader('Authorization', 'Bearer '.$this->token) $response = $this->withHeader('Authorization', 'Bearer '.$this->token)
->post('/api/roles', [ ->post('/api/roles', [
'name'=>'New Role', 'name' => 'New Role',
'slug'=>'new-role', 'slug' => 'new-role',
]); ]);
$response $response

@ -168,9 +168,9 @@ class UserTest extends TestCase {
public function test_delete_admin_user_if_multiple_admins_are_present() { public function test_delete_admin_user_if_multiple_admins_are_present() {
$newAdminUser = User::create([ $newAdminUser = User::create([
'name'=>'Test Admin', 'name' => 'Test Admin',
'password'=>Hash::make('abcd'), 'password' => Hash::make('abcd'),
'email'=>'testadmin@test.com', 'email' => 'testadmin@test.com',
]); ]);
$adminRole = Role::find(1); $adminRole = Role::find(1);

Loading…
Cancel
Save