This repository has been archived by the owner on Oct 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9f35a85
commit 8021730
Showing
1,694 changed files
with
130,284 additions
and
25,383 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
APP_NAME=Laravel | ||
APP_NAME="Laravel Architect Ui" | ||
APP_ENV=local | ||
APP_KEY= | ||
APP_DEBUG=true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
150 changes: 150 additions & 0 deletions
150
app/Http/Controllers/Backend/Admin/AdminUsersController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\Backend\Admin; | ||
|
||
use Hash; | ||
use App\Helper\ResponseHelper; | ||
use Illuminate\Http\Request; | ||
use App\Http\Controllers\Controller; | ||
use Yajra\DataTables\DataTables; | ||
use App\Models\{Role, AdminUser}; | ||
use App\Http\Requests\{StoreAdminUser, UpdateAdminUser}; | ||
|
||
class AdminUsersController extends Controller | ||
{ | ||
/** | ||
* Display a listing of the resource. | ||
* | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function index(Request $request) | ||
{ | ||
if($request->ajax()) { | ||
$admin_users = AdminUser::anyTrash($request->trash); | ||
|
||
return DataTables::of($admin_users) | ||
->addColumn('roles', function ($admin_user) { | ||
return $admin_user->getRoleNames()->reduce(function($carry, $each) { | ||
return "${carry}<span class='badge badge-primary mr-1'>${each}</span>"; | ||
}); | ||
}) | ||
->addColumn('action', function ($admin_user) use ($request) { | ||
$detail_btn = ''; | ||
$restore_btn = ''; | ||
$edit_btn = '<a class="edit text text-primary mr-2" href="' . route('admin.admin-users.edit', ['admin_user' => $admin_user->id]) . '"><i class="far fa-edit fa-lg"></i></a>'; | ||
|
||
if ($request->trash == 1) { | ||
$restore_btn = '<a class="restore text text-warning mr-2" href="#" data-id="' . $admin_user->id . '"><i class="fa fa-trash-restore fa-lg"></i></a>'; | ||
$trash_or_delete_btn = '<a class="destroy text text-danger mr-2" href="#" data-id="' . $admin_user->id . '"><i class="fa fa-minus-circle fa-lg"></i></a>'; | ||
} else { | ||
$trash_or_delete_btn = '<a class="trash text text-danger mr-2" href="#" data-id="' . $admin_user->id . '"><i class="fas fa-trash fa-lg"></i></a>'; | ||
} | ||
|
||
return "${detail_btn} ${edit_btn} ${restore_btn} ${trash_or_delete_btn}"; | ||
}) | ||
->addColumn('plus-icon', function () { | ||
return null; | ||
}) | ||
->rawColumns(['roles', 'action', 'plus-icon']) | ||
->make(true); | ||
} | ||
|
||
return view('backend.admin.admin_users.index'); | ||
} | ||
|
||
/** | ||
* Show the form for creating a new resource. | ||
* | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function create() | ||
{ | ||
$roles = Role::where('guard_name', config('custom_guards.default.admin'))->get(); | ||
return view('backend.admin.admin_users.create', compact('roles')); | ||
} | ||
|
||
/** | ||
* Store a newly created resource in storage. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function store(StoreAdminUser $request) | ||
{ | ||
$created = AdminUser::create([ | ||
'name' => $request->name, | ||
'email' => $request->email, | ||
'password' => Hash::make($request->password) | ||
]); | ||
$created->syncRoles($request->roles); | ||
|
||
return redirect()->route('admin.admin-users.index')->with('success', 'New Admin User Successfully Created.'); | ||
} | ||
|
||
/** | ||
* Display the specified resource. | ||
* | ||
* @param int $id | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function show(AdminUser $admin_user) | ||
{ | ||
return view('backend.admin.admin_users.show', compact('admin_user')); | ||
} | ||
|
||
/** | ||
* Show the form for editing the specified resource. | ||
* | ||
* @param int $id | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function edit(AdminUser $admin_user) | ||
{ | ||
$roles = Role::where('guard_name', config('custom_guards.default.admin'))->get(); | ||
return view('backend.admin.admin_users.edit', compact('admin_user', 'roles')); | ||
} | ||
|
||
/** | ||
* Update the specified resource in storage. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @param int $id | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function update(UpdateAdminUser $request, AdminUser $admin_user) | ||
{ | ||
$admin_user->name = $request->name; | ||
$admin_user->email = $request->email; | ||
if(! empty($request->password)) { | ||
$admin_user->password = Hash::make($request->password); | ||
} | ||
$admin_user->save(); | ||
$admin_user->syncRoles($request->roles); | ||
|
||
return redirect()->route('admin.admin-users.index')->with('success', 'Successfully Updated.'); | ||
} | ||
|
||
/** | ||
* Remove the specified resource from storage. | ||
* | ||
* @param int $id | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function destroy(AdminUser $admin_user) | ||
{ | ||
$admin_user->delete(); | ||
return ResponseHelper::success(); | ||
} | ||
|
||
public function trash(AdminUser $admin_user) | ||
{ | ||
$admin_user->trash(); | ||
return ResponseHelper::success(); | ||
} | ||
|
||
public function restore(AdminUser $admin_user) | ||
{ | ||
$admin_user->restore(); | ||
return ResponseHelper::success(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
150 changes: 150 additions & 0 deletions
150
app/Http/Controllers/Backend/Admin/ClientUsersController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\Backend\Admin; | ||
|
||
use Hash; | ||
use App\Helper\ResponseHelper; | ||
use Illuminate\Http\Request; | ||
use App\Http\Controllers\Controller; | ||
use Yajra\DataTables\DataTables; | ||
use App\Models\{Role, User as ClientUser}; | ||
use App\Http\Requests\{StoreClientUser, UpdateClientUser}; | ||
|
||
class ClientUsersController extends Controller | ||
{ | ||
/** | ||
* Display a listing of the resource. | ||
* | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function index(Request $request) | ||
{ | ||
if ($request->ajax()) { | ||
$client_users = ClientUser::anyTrash($request->trash); | ||
|
||
return DataTables::of($client_users) | ||
->addColumn('roles', function ($client_user) { | ||
return $client_user->getRoleNames()->reduce(function ($carry, $each) { | ||
return "${carry}<span class='badge badge-primary mr-1'>${each}</span>"; | ||
}); | ||
}) | ||
->addColumn('action', function ($client_user) use ($request) { | ||
$detail_btn = ''; | ||
$restore_btn = ''; | ||
$edit_btn = '<a class="edit text text-primary mr-2" href="' . route('admin.client-users.edit', ['client_user' => $client_user->id]) . '"><i class="far fa-edit fa-lg"></i></a>'; | ||
|
||
if ($request->trash == 1) { | ||
$restore_btn = '<a class="restore text text-warning mr-2" href="#" data-id="' . $client_user->id . '"><i class="fa fa-trash-restore fa-lg"></i></a>'; | ||
$trash_or_delete_btn = '<a class="destroy text text-danger mr-2" href="#" data-id="' . $client_user->id . '"><i class="fa fa-minus-circle fa-lg"></i></a>'; | ||
} else { | ||
$trash_or_delete_btn = '<a class="trash text text-danger mr-2" href="#" data-id="' . $client_user->id . '"><i class="fas fa-trash fa-lg"></i></a>'; | ||
} | ||
|
||
return "${detail_btn} ${edit_btn} ${restore_btn} ${trash_or_delete_btn}"; | ||
}) | ||
->addColumn('plus-icon', function () { | ||
return null; | ||
}) | ||
->rawColumns(['roles', 'action', 'plus-icon']) | ||
->make(true); | ||
} | ||
|
||
return view('backend.admin.client_users.index'); | ||
} | ||
|
||
/** | ||
* Show the form for creating a new resource. | ||
* | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function create() | ||
{ | ||
$roles = Role::where('guard_name', config('custom_guards.default.user'))->get(); | ||
return view('backend.admin.client_users.create', compact('roles')); | ||
} | ||
|
||
/** | ||
* Store a newly created resource in storage. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function store(StoreClientUser $request) | ||
{ | ||
$created = ClientUser::create([ | ||
'name' => $request->name, | ||
'email' => $request->email, | ||
'password' => Hash::make($request->password) | ||
]); | ||
$created->syncRoles($request->roles); | ||
|
||
return redirect()->route('admin.client-users.index')->with('success', 'New User Successfully Created.'); | ||
} | ||
|
||
/** | ||
* Display the specified resource. | ||
* | ||
* @param int $id | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function show(ClientUser $client_user) | ||
{ | ||
return view('backend.admin.client_users.show', compact('client_user')); | ||
} | ||
|
||
/** | ||
* Show the form for editing the specified resource. | ||
* | ||
* @param int $id | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function edit(ClientUser $client_user) | ||
{ | ||
$roles = Role::where('guard_name', config('custom_guards.default.user'))->get(); | ||
return view('backend.admin.client_users.edit', compact('client_user', 'roles')); | ||
} | ||
|
||
/** | ||
* Update the specified resource in storage. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @param int $id | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function update(UpdateClientUser $request, ClientUser $client_user) | ||
{ | ||
$client_user->name = $request->name; | ||
$client_user->email = $request->email; | ||
if (! empty($request->password)) { | ||
$client_user->password = Hash::make($request->password); | ||
} | ||
$client_user->save(); | ||
$client_user->syncRoles($request->roles); | ||
|
||
return redirect()->route('admin.client-users.index')->with('success', 'Successfully Updated.'); | ||
} | ||
|
||
/** | ||
* Remove the specified resource from storage. | ||
* | ||
* @param int $id | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function destroy(ClientUser $client_user) | ||
{ | ||
$client_user->delete(); | ||
return ResponseHelper::success(); | ||
} | ||
|
||
public function trash(ClientUser $client_user) | ||
{ | ||
$client_user->trash(); | ||
return ResponseHelper::success(); | ||
} | ||
|
||
public function restore(ClientUser $client_user) | ||
{ | ||
$client_user->restore(); | ||
return ResponseHelper::success(); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
app/Http/Controllers/Backend/Admin/PermissionsController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\Backend\Admin; | ||
|
||
use Illuminate\Http\Request; | ||
use App\Http\Controllers\Controller; | ||
use App\Models\Permission; | ||
use Yajra\DataTables\DataTables; | ||
|
||
class PermissionsController extends Controller | ||
{ | ||
/** | ||
* Display a listing of the resource. | ||
* | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function index(Request $request) | ||
{ | ||
if ($request->ajax()) { | ||
$permissions = Permission::where('guard_name', $request->guard); | ||
return DataTables::of($permissions)->make(true); | ||
} | ||
|
||
return view('backend.admin.permissions.index'); | ||
} | ||
} |
Oops, something went wrong.