Skip to content

Commit

Permalink
Apply fixes from StyleCI
Browse files Browse the repository at this point in the history
[ci skip] [skip ci]
  • Loading branch information
uyab authored and StyleCIBot committed Jan 11, 2020
1 parent ee122c3 commit 08f5faa
Show file tree
Hide file tree
Showing 25 changed files with 91 additions and 70 deletions.
1 change: 1 addition & 0 deletions resources/lang/en/label.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

return [
'roles' => 'Roles',
'users' => 'Users',
Expand Down
1 change: 1 addition & 0 deletions resources/lang/en/menu.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

return [
'epicentrum' => 'User Management',
'account' => 'Account',
Expand Down
1 change: 1 addition & 0 deletions resources/lang/id/label.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

return [
'roles' => 'Roles',
'permissions' => 'Hak Akses',
Expand Down
1 change: 1 addition & 0 deletions resources/lang/id/menu.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

return [
'epicentrum' => 'Manajemen User',
'account' => 'Akun',
Expand Down
2 changes: 1 addition & 1 deletion resources/lang/id/users.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
'pages' => [
'index' => [
'header' => 'Manage Users',
]
],
],
'send_account_information_via_email' => 'Kirim informasi akun dan password via email',
'change_password_on_first_login' => 'Paksa untuk ganti password ketika pertama kali login',
Expand Down
10 changes: 5 additions & 5 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function ($router) {

$router
->namespace('User')
->middleware('can:' . \Laravolt\Platform\Enums\Permission::MANAGE_USER)
->middleware('can:'.\Laravolt\Platform\Enums\Permission::MANAGE_USER)
->group(function ($router) {
$router->resource('users', 'UserController');
$router->resource('account', 'AccountController')->only('edit', 'update');
Expand All @@ -31,14 +31,14 @@ function ($router) {
});

$router
->middleware('can:' . \Laravolt\Platform\Enums\Permission::MANAGE_ROLE)
->middleware('can:'.\Laravolt\Platform\Enums\Permission::MANAGE_ROLE)
->resource('roles', 'RoleController');

$router
->middleware('can:' . \Laravolt\Platform\Enums\Permission::MANAGE_PERMISSION)
->middleware('can:'.\Laravolt\Platform\Enums\Permission::MANAGE_PERMISSION)
->group(function ($router) {
$router->get('permissions', ['uses' => "PermissionController@edit", 'as' => 'permissions.edit']);
$router->put('permissions', ['uses' => "PermissionController@update", 'as' => 'permissions.update']);
$router->get('permissions', ['uses' => 'PermissionController@edit', 'as' => 'permissions.edit']);
$router->put('permissions', ['uses' => 'PermissionController@update', 'as' => 'permissions.update']);
});
}
);
4 changes: 1 addition & 3 deletions src/Epicentrum/Console/Commands/ManageRole.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public function handle()
if ($role) {
$this->chooseAction($role);
}

}

protected function validateRole($identifier)
Expand All @@ -52,7 +51,7 @@ protected function validateRole($identifier)
$role = app('laravolt.epicentrum.role')->whereName($identifier)->first();
}

if(!$role) {
if (!$role) {
$createNew = $this->confirm('Role not found, do you want to create a new role named '.$identifier);

if ($createNew) {
Expand Down Expand Up @@ -91,6 +90,5 @@ protected function actionChangePermission($role)

protected function actionChangePassword()
{

}
}
6 changes: 4 additions & 2 deletions src/Epicentrum/Http/Controllers/My/PasswordController.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class PasswordController extends Controller

/**
* PasswordController constructor.
*
* @param UserRepositoryEloquent $repository
*/
public function __construct(RepositoryInterface $repository)
Expand All @@ -31,7 +32,8 @@ public function __construct(RepositoryInterface $repository)
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @param int $id
*
* @return \Illuminate\Http\Response
*/
public function edit()
Expand All @@ -45,10 +47,10 @@ public function update(Update $request)
{
if (app('hash')->check($request->password_current, auth()->user()->password)) {
auth()->user()->setPassword($request->password);

return redirect()->back()->withSuccess(trans('laravolt::message.password_updated'));
} else {
return redirect()->back()->withError(trans('laravolt::message.current_password_mismatch'));
}

}
}
3 changes: 2 additions & 1 deletion src/Epicentrum/Http/Controllers/My/ProfileController.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class ProfileController extends Controller
* PasswordController constructor.
*
* @param RepositoryInterface $repository
* @param TimezoneRepository $timezone
* @param TimezoneRepository $timezone
*/
public function __construct(RepositoryInterface $repository, TimezoneRepository $timezone)
{
Expand All @@ -30,6 +30,7 @@ public function __construct(RepositoryInterface $repository, TimezoneRepository

/**
* Show the form for editing the specified resource.
*
* @return \Illuminate\Http\Response
*/
public function edit()
Expand Down
17 changes: 11 additions & 6 deletions src/Epicentrum/Http/Controllers/RoleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ class RoleController extends Controller

/**
* UserController constructor.
* @param RoleRepository $repository
*
* @param RoleRepository $repository
*/
public function __construct(RoleRepositoryInterface $repository)
{
Expand Down Expand Up @@ -51,7 +52,8 @@ public function create()
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\Response
*/
public function store(Store $request)
Expand All @@ -69,7 +71,8 @@ public function show($id)
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @param int $id
*
* @return \Illuminate\Http\Response
*/
public function edit($id)
Expand All @@ -84,8 +87,9 @@ public function edit($id)
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @param \Illuminate\Http\Request $request
* @param int $id
*
* @return \Illuminate\Http\Response
*/
public function update(Update $request, $id)
Expand All @@ -98,7 +102,8 @@ public function update(Update $request, $id)
/**
* Remove the specified resource from storage.
*
* @param int $id
* @param int $id
*
* @return \Illuminate\Http\Response
*/
public function destroy($id)
Expand Down
8 changes: 5 additions & 3 deletions src/Epicentrum/Http/Controllers/User/AccountController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ class AccountController extends UserController
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @param int $id
*
* @return \Illuminate\Http\Response
*/
public function edit($id)
Expand All @@ -27,8 +28,9 @@ public function edit($id)
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @param \Illuminate\Http\Request $request
* @param int $id
*
* @return \Illuminate\Http\Response
*/
public function update(Update $request, $id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ class PasswordController extends Controller

/**
* PasswordController constructor.
* @param UserRepositoryEloquent $repository
*
* @param UserRepositoryEloquent $repository
*/
public function __construct(RepositoryInterface $repository)
{
Expand All @@ -24,7 +25,8 @@ public function __construct(RepositoryInterface $repository)
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @param int $id
*
* @return \Illuminate\Http\Response
*/
public function edit($id)
Expand Down
18 changes: 11 additions & 7 deletions src/Epicentrum/Http/Controllers/User/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
use Illuminate\Database\QueryException;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
use Illuminate\Support\Facades\Mail;
use Laravolt\Epicentrum\Contracts\Requests\Account\Delete;
use Laravolt\Epicentrum\Contracts\Requests\Account\Store;
use Laravolt\Epicentrum\Mail\AccountInformation;
use Laravolt\Epicentrum\Repositories\RepositoryInterface;
use Illuminate\Support\Facades\Mail;
use Laravolt\Support\Contracts\TimezoneRepository;
use Laravolt\Suitable\TableView;
use Laravolt\Support\Contracts\TimezoneRepository;

class UserController extends Controller
{
Expand All @@ -27,8 +27,9 @@ class UserController extends Controller

/**
* UserController constructor.
* @param UserRepositoryEloquent $repository
* @param TimezoneRepositoryArray $timezone
*
* @param UserRepositoryEloquent $repository
* @param TimezoneRepositoryArray $timezone
*/
public function __construct(RepositoryInterface $repository, TimezoneRepository $timezone)
{
Expand All @@ -39,8 +40,9 @@ public function __construct(RepositoryInterface $repository, TimezoneRepository
/**
* Display a listing of the resource.
*
* @return Response
* @throws \Exception
*
* @return Response
*/
public function index(Request $request)
{
Expand Down Expand Up @@ -71,7 +73,8 @@ public function create()
/**
* Store the specified resource.
*
* @param Store $request
* @param Store $request
*
* @return Response
*/
public function store(Store $request)
Expand All @@ -92,7 +95,8 @@ public function store(Store $request)
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @param int $id
*
* @return Response
*/
public function edit($id)
Expand Down
2 changes: 2 additions & 0 deletions src/Epicentrum/Http/Requests/Account/Delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class Delete extends FormRequest implements \Laravolt\Epicentrum\Contracts\Reque
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
Expand All @@ -22,6 +23,7 @@ public function authorize()

/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
Expand Down
2 changes: 1 addition & 1 deletion src/Epicentrum/Http/Requests/Account/Store.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function rules()
'name' => 'required|max:255',
'email' => 'required|email|unique:users',
'password' => 'required|min:6|max:255',
'status' => 'required'
'status' => 'required',
];
}
}
3 changes: 2 additions & 1 deletion src/Epicentrum/Http/Requests/Account/Update.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@ public function authorize()
public function rules()
{
$id = request()->route('account');

return [
'name' => 'required|max:255',
'email' => [
'required',
'email',
Rule::unique(auth()->user()->getTable())->ignore($id)
Rule::unique(auth()->user()->getTable())->ignore($id),
],
'status' => 'required',
'timezone' => 'required',
Expand Down
4 changes: 2 additions & 2 deletions src/Epicentrum/Http/Requests/AdminEditProfile.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ public function rules()
{
return [
'name' => 'required|max:255',
'email' => 'required|email|unique:users,id,' . auth()->user()->getAuthIdentifier(),
'status' => 'required'
'email' => 'required|email|unique:users,id,'.auth()->user()->getAuthIdentifier(),
'status' => 'required',
];
}
}
2 changes: 2 additions & 0 deletions src/Epicentrum/Http/Requests/My/Profile/Update.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class Update extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
Expand All @@ -17,6 +18,7 @@ public function authorize()

/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
Expand Down
1 change: 0 additions & 1 deletion src/Epicentrum/Http/Requests/Role/Update.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Laravolt\Epicentrum\Http\Requests\Role;

use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

class Update extends FormRequest
{
Expand Down
5 changes: 2 additions & 3 deletions src/Epicentrum/Mail/AccountInformation.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;

class AccountInformation extends Mailable
{
use Queueable, SerializesModels;

use Queueable;
use SerializesModels;
public $user;

public $plainPassword;
Expand Down
Loading

0 comments on commit 08f5faa

Please sign in to comment.