/** * View route permission * @param int $id * @return Response */ public function show($id) { // get permissions and roles of a route by id $routePermission = RoutePermission::find($id); if (!$routePermission) { return response()->json(null, 404); } return response()->json(arrayView('phpsoft.users::routePermission/read', ['routePermission' => $routePermission]), 200); }
public function testDeleteSuccess() { $credentials = ['email' => '*****@*****.**', 'password' => '123456']; $token = JWTAuth::attempt($credentials); $routePermission = factory(RoutePermission::class)->create(['route' => '/users', 'permissions' => json_encode(['review']), 'roles' => json_encode(['manager'])]); $res = $this->call('DELETE', "/routePermissions/{$routePermission->id}", [], [], [], ['HTTP_Authorization' => "Bearer {$token}"]); $this->assertEquals(204, $res->getStatusCode()); $exists = RoutePermission::find($routePermission->id); $this->assertNull($exists); }