Commit 9c33c597 authored by cygnet's avatar cygnet

Resolved merge conflict by incorporating changes

parents 99ac8f95 1cb96da9
......@@ -8,7 +8,6 @@ use App\Repositories\Backend\Access\Permission\PermissionRepository;
use Illuminate\Http\Request;
use Validator;
class PermissionController extends APIController
{
protected $repository;
......@@ -50,7 +49,7 @@ class PermissionController extends APIController
}
/**
* Creates the Resourse for Role
* Creates the Resourse for Role.
*
* @param Request $request
*
......@@ -65,10 +64,10 @@ class PermissionController extends APIController
$this->repository->create($request->all());
$permission = Permission::orderBy('created_at', 'desc')->first();
return new PermissionResource($permission);
}
/**
* @param Role $role
* @param UpdateRoleRequest $request
......@@ -77,7 +76,6 @@ class PermissionController extends APIController
*/
public function update(Request $request, Permission $permission)
{
$validation = $this->valiatingRequest($request);
if ($validation->fails()) {
......@@ -93,13 +91,14 @@ class PermissionController extends APIController
public function valiatingRequest(Request $request)
{
$validation = Validator::make($request->all(),[
$validation = Validator::make($request->all(), [
'name' => 'required|max:191',
'display_name' => 'required|max:191',
]);
return $validation;
}
/**
* @param Role $role
* @param DeleteRoleRequest $request
......@@ -110,6 +109,6 @@ class PermissionController extends APIController
{
$this->repository->delete($permission);
return ["message"=>"success"];
return ['message'=>'success'];
}
}
......@@ -8,7 +8,6 @@ use App\Repositories\Backend\Access\Role\RoleRepository;
use Illuminate\Http\Request;
use Validator;
class RolesController extends APIController
{
protected $repository;
......@@ -50,7 +49,7 @@ class RolesController extends APIController
}
/**
* Creates the Resourse for Role
* Creates the Resourse for Role.
*
* @param Request $request
*
......@@ -65,11 +64,9 @@ class RolesController extends APIController
$this->repository->create($request->all());
return new RoleResource(Role::orderBy('created_at', 'desc')->first());
}
/**
* @param Role $role
* @param UpdateRoleRequest $request
......@@ -78,7 +75,6 @@ class RolesController extends APIController
*/
public function update(Request $request, Role $role)
{
$validation = $this->valiatingRequest($request);
if ($validation->fails()) {
......@@ -87,7 +83,7 @@ class RolesController extends APIController
$this->repository->update($role, $request->all());
$role= Role::findOrfail($role->id);
$role = Role::findOrfail($role->id);
return new RoleResource($role);
}
......@@ -96,7 +92,7 @@ class RolesController extends APIController
{
$permissions = '';
if ($request->post("associated_permissions") != 'all') {
if ($request->post('associated_permissions') != 'all') {
$permissions = 'required';
}
......@@ -107,6 +103,7 @@ class RolesController extends APIController
return $validation;
}
/**
* @param Role $role
* @param DeleteRoleRequest $request
......@@ -117,6 +114,6 @@ class RolesController extends APIController
{
$this->repository->delete($role);
return ["message"=>"success"];
return ['message'=>'success'];
}
}
......@@ -6,7 +6,6 @@ use App\Http\Resources\UserResource;
use App\Models\Access\User\User;
use App\Repositories\Backend\Access\User\UserRepository;
use Illuminate\Http\Request;
use Illuminate\Validation\Rule;
use Validator;
class UsersController extends APIController
......@@ -47,9 +46,10 @@ class UsersController extends APIController
public function show(User $user)
{
$data = new UserResource($user);
$history["history"] = history()->renderEntity('User', $user->id);
$history['history'] = history()->renderEntity('User', $user->id);
$maindata = $data->toArray($user);
$maindata = array_merge($maindata, $history);
return $maindata;
}
......@@ -79,7 +79,6 @@ class UsersController extends APIController
public function deleteUserList(Request $request)
{
$limit = $request->get('paginate') ? $request->get('paginate') : 25;
return UserResource::collection(
$this->repository->getForDataTable(0, true)->paginate($limit)
);
......@@ -90,7 +89,7 @@ class UsersController extends APIController
*/
public function update(Request $request, User $user)
{
$validation = $this->valiatingRequest($request,"edit",$user->id);
$validation = $this->valiatingRequest($request, 'edit', $user->id);
if ($validation->fails()) {
return $this->throwValidation($validation->messages()->first());
......@@ -114,14 +113,16 @@ class UsersController extends APIController
return $this->throwValidation($validation->messages()->first());
}
$this->repository->create($request);
return new UserResource(User::orderBy('created_at', 'desc')->first());
}
/**
* Validation function to validate user input
* Validation function to validate user input.
*/
public function valiatingRequest(Request $request,$string="",$id=0)
public function valiatingRequest(Request $request, $string = '', $id = 0)
{
$password = ($string=="edit")?"":"required|min:6|confirmed";
$password = ($string == 'edit') ? '' : 'required|min:6|confirmed';
$validation = Validator::make($request->all(), [
'first_name' => 'required|max:255',
'last_name' => 'required|max:255',
......@@ -135,7 +136,8 @@ class UsersController extends APIController
}
/**
* Api to delete the resource
* Api to delete the resource.
*
* @param Role $role
* @param DeleteRoleRequest $request
*
......@@ -145,6 +147,6 @@ class UsersController extends APIController
{
$this->repository->delete($user);
return ["message" => "success"];
return ['message' => 'success'];
}
}
<?php
namespace App\Http\Middleware;
use Fideloper\Proxy\TrustProxies as Middleware;
use Illuminate\Http\Request;
/**
* Class TrustProxies.
*/
class TrustProxies extends Middleware
{
/**
* The trusted proxies for this application.
*
* @var array
*/
protected $proxies;
/**
* The headers that should be used to detect proxies.
*
* @var string
*/
protected $headers = Request::HEADER_X_FORWARDED_ALL;
}
......@@ -18,9 +18,9 @@ class RoleResource extends Resource
return [
'id' => $this->id,
'name' => $this->name,
"permission" => ($this->all)? "All": optional($this->permissions)->pluck("display_name"),
"noofuses" => $this->users->count(),
"sort" => $this->sort,
'permission' => ($this->all) ? 'All' : optional($this->permissions)->pluck('display_name'),
'noofuses' => $this->users->count(),
'sort' => $this->sort,
];
}
}
......@@ -25,7 +25,6 @@ class UserResource extends Resource
'registered_at' => $this->created_at->toIso8601String(),
'last_updated_at' => $this->updated_at->toIso8601String(),
];
}
}
......@@ -11,31 +11,31 @@
"license": "MIT",
"type": "project",
"require": {
"php": ">=7.0.0",
"arcanedev/log-viewer": "^4.4",
"php": ">=7.1.3",
"arcanedev/log-viewer": "^4.5",
"arcanedev/no-captcha": "^5.0",
"codedungeon/phpunit-result-printer": "0.4.4",
"creativeorange/gravatar": "~1.0",
"davejamesmiller/laravel-breadcrumbs": "^4.1",
"davejamesmiller/laravel-breadcrumbs": "^5.0",
"doctrine/dbal": "^2.6",
"fideloper/proxy": "~3.3",
"fideloper/proxy": "~4.0",
"hieu-le/active": "^3.5",
"laravel/framework": "5.5.*",
"laravel/framework": "5.6.*",
"laravel/socialite": "^3.0",
"laravel/tinker": "~1.0",
"laravelcollective/html": "^5.5.0",
"laravelcollective/html": "^5.4.0",
"tymon/jwt-auth": "dev-develop",
"unisharp/laravel-filemanager": "~1.8",
"yajra/laravel-datatables-oracle": "~8.0"
},
"require-dev": {
"barryvdh/laravel-debugbar": "^3.0",
"codedungeon/phpunit-result-printer": "^0.6.0",
"bvipul/generator": "^0.9.1",
"filp/whoops": "~2.0",
"fzaninotto/faker": "~1.4",
"laravel/browser-kit-testing": "^2.0",
"laravel/browser-kit-testing": "^4.0.0",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~6.0",
"phpunit/phpunit": "~7.0",
"xethron/migrations-generator": "2.0.2"
},
"autoload": {
......@@ -69,14 +69,6 @@
"post-create-project-cmd": [
"php artisan key:generate"
],
"post-install-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postInstall",
"php artisan optimize"
],
"post-update-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postUpdate",
"php artisan optimize"
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover"
......
This diff is collapsed.
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Hash Driver
|--------------------------------------------------------------------------
|
| This option controls the default hash driver that will be used to hash
| passwords for your application. By default, the bcrypt algorithm is
| used; however, you remain free to modify this option if you wish.
|
| Supported: "bcrypt", "argon"
|
*/
'driver' => 'bcrypt',
];
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Log Channel
|--------------------------------------------------------------------------
|
| This option defines the default log channel that gets used when writing
| messages to the logs. The name specified in this option should match
| one of the channels defined in the "channels" configuration array.
|
*/
'default' => env('LOG_CHANNEL', 'stack'),
/*
|--------------------------------------------------------------------------
| Log Channels
|--------------------------------------------------------------------------
|
| Here you may configure the log channels for your application. Out of
| the box, Laravel uses the Monolog PHP logging library. This gives
| you a variety of powerful log handlers / formatters to utilize.
|
| Available Drivers: "single", "daily", "slack", "syslog",
| "errorlog", "custom", "stack"
|
*/
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => ['single'],
],
'single' => [
'driver' => 'single',
'path' => storage_path('logs/laravel.log'),
'level' => 'debug',
],
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),
'level' => 'debug',
'days' => 7,
],
'slack' => [
'driver' => 'slack',
'url' => env('LOG_SLACK_WEBHOOK_URL'),
'username' => 'Laravel Log',
'emoji' => ':boom:',
'level' => 'critical',
],
'syslog' => [
'driver' => 'syslog',
'level' => 'debug',
],
'errorlog' => [
'driver' => 'errorlog',
'level' => 'debug',
],
],
];
<?php
return [
/*
* Set trusted proxy IP addresses.
*
* Both IPv4 and IPv6 addresses are
* supported, along with CIDR notation.
*
* The "*" character is syntactic sugar
* within TrustedProxy to trust any proxy
* that connects directly to your server,
* a requirement when you cannot know the address
* of your proxy (e.g. if using Rackspace balancers).
*
* The "**" character is syntactic sugar within
* TrustedProxy to trust not just any proxy that
* connects directly to your server, but also
* proxies that connect to those proxies, and all
* the way back until you reach the original source
* IP. It will mean that $request->getClientIp()
* always gets the originating client IP, no matter
* how many proxies that client's request has
* subsequently passed through.
*/
'proxies' => [
'192.168.1.10',
],
/*
* Or, to trust all proxies that connect
* directly to your server, uncomment this:
*/
// 'proxies' => '*',
/*
* Or, to trust ALL proxies, including those that
* are in a chain of forwarding, uncomment this:
*/
// 'proxies' => '**',
/*
* Default Header Names
*
* Change these if the proxy does
* not send the default header names.
*
* Note that headers such as X-Forwarded-For
* are transformed to HTTP_X_FORWARDED_FOR format.
*
* The following are Symfony defaults, found in
* \Symfony\Component\HttpFoundation\Request::$trustedHeaders
*
* You may optionally set headers to 'null' here if you'd like
* for them to be considered untrusted instead. Ex:
*
* Illuminate\Http\Request::HEADER_CLIENT_HOST => null,
*
* WARNING: If you're using AWS Elastic Load Balancing or Heroku,
* the FORWARDED and X_FORWARDED_HOST headers should be set to null
* as they are currently unsupported there.
*/
'headers' => [
(defined('Illuminate\Http\Request::HEADER_FORWARDED') ? Illuminate\Http\Request::HEADER_FORWARDED : 'forwarded') => 'FORWARDED',
Illuminate\Http\Request::HEADER_CLIENT_IP => 'X_FORWARDED_FOR',
Illuminate\Http\Request::HEADER_CLIENT_HOST => 'X_FORWARDED_HOST',
Illuminate\Http\Request::HEADER_CLIENT_PROTO => 'X_FORWARDED_PROTO',
Illuminate\Http\Request::HEADER_CLIENT_PORT => 'X_FORWARDED_PORT',
],
];
......@@ -14,7 +14,7 @@ class LogViewerRouteTest extends BrowserKitTestCase
{
$this->actingAs($this->admin)
->visit('/admin/log-viewer')
->see('Log Viewer');
->see('LogViewer');
}
/** @test **/
......@@ -25,19 +25,19 @@ class LogViewerRouteTest extends BrowserKitTestCase
->see('Logs');
}
/** @test **/
public function admin_users_can_see_logviewer_single_date()
/* @test **/
/*public function admin_users_can_see_logviewer_single_date()
{
$this->actingAs($this->admin)
->visit('/admin/log-viewer/logs/'.date('Y-m-d'))
->see('Log ['.date('Y-m-d').']');
}
}*/
/** @test **/
public function admin_users_can_see_logviewer_single_date_type()
/* @test **/
/*public function admin_users_can_see_logviewer_single_date_type()
{
$this->actingAs($this->admin)
->visit('/admin/log-viewer/logs/'.date('Y-m-d').'/error')
->see('Log ['.date('Y-m-d').']');
}
}*/
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment