112 lines
2.7 KiB
PHP
112 lines
2.7 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Management;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use Illuminate\Http\Request;
|
|
use App\Models\User;
|
|
|
|
class UserController extends Controller
|
|
{
|
|
protected $title = 'User';
|
|
protected $template = 'modules.management.user';
|
|
protected $route = 'modules.management.user';
|
|
|
|
/**
|
|
* Display a listing of the resource.
|
|
*/
|
|
public function index()
|
|
{
|
|
$data['breadcrumbs'] = [
|
|
['name' => 'Dashboard','url' => url('dashboard')],
|
|
['name' => 'Management & Akses Role'],
|
|
['name' => 'Data User','active' => true],
|
|
];
|
|
$data['title'] = $this->title;
|
|
$data['route'] = $this->route;
|
|
return view($this->template.'.index',$data);
|
|
}
|
|
|
|
public function grid(Request $request)
|
|
{
|
|
|
|
$data = User::where('id','!=',auth()->user()->id)->orderBy('id','DESC')->get();
|
|
$_data = [];
|
|
|
|
|
|
foreach ($data as $key => $row) {
|
|
|
|
|
|
$action = '';
|
|
|
|
if((permission('is_create', $this->route.'.*','module',false)) || (permission('is_update', $this->route.'.*','module',false))){
|
|
$action .= '<a data-toggle="tooltip" title="Edit Data" class="btn btn-xs btn-block btn-primary"><i class="fal fa-pencil text-white"></i></a>';
|
|
$action .= '<a data-toggle="tooltip" title="Edit Data" class="btn btn-xs btn-block btn-danger"><i class="fal fa-trash text-white"></i></a>';
|
|
}
|
|
|
|
$_data[] = [
|
|
'no' => $key+1,
|
|
'id' => encode_id($row->id),
|
|
'name' => @$row->name,
|
|
'username' => @$row->username,
|
|
'email' => @$row->email,
|
|
'created_at' => dateTime(@$row->created_at),
|
|
'action' => @$action,
|
|
];
|
|
|
|
}
|
|
|
|
// return response()->json($_data); // Return the data as a JSON response
|
|
return response()->json($_data);
|
|
|
|
}
|
|
|
|
/**
|
|
* Show the form for creating a new resource.
|
|
*/
|
|
public function create()
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Store a newly created resource in storage.
|
|
*/
|
|
public function store(Request $request)
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Display the specified resource.
|
|
*/
|
|
public function show(string $id)
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Show the form for editing the specified resource.
|
|
*/
|
|
public function edit(string $id)
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Update the specified resource in storage.
|
|
*/
|
|
public function update(Request $request, string $id)
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Remove the specified resource from storage.
|
|
*/
|
|
public function destroy(string $id)
|
|
{
|
|
//
|
|
}
|
|
}
|