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) {
if ($exception instanceof ModelNotFoundException) {
return response([
'error'=>1,
'message'=>$exception->getMessage(),
'error' => 1,
'message' => $exception->getMessage(),
], 404);
}
if ($exception instanceof MissingAbilityException) {
return response([
'error'=>1,
'message'=>'Not authorized',
'error' => 1,
'message' => 'Not authorized',
], 409);
}

@ -5,13 +5,13 @@ namespace App\Http\Controllers;
class HydraController extends Controller {
public function hydra() {
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() {
return response([
'version'=> config('hydra.version'),
'version' => config('hydra.version'),
]);
}
}

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

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

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

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

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

Loading…
Cancel
Save