-
Notifications
You must be signed in to change notification settings - Fork 0
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
0 parents
commit 26ee833
Showing
298 changed files
with
99,342 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 4 | ||
trim_trailing_whitespace = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false | ||
|
||
[*.yml] | ||
indent_style = space | ||
indent_size = 2 |
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,39 @@ | ||
APP_NAME=Laravel | ||
APP_ENV=local | ||
APP_KEY= | ||
APP_DEBUG=true | ||
APP_URL=http://localhost | ||
|
||
LOG_CHANNEL=stack | ||
|
||
DB_CONNECTION=mysql | ||
DB_HOST=127.0.0.1 | ||
DB_PORT=3306 | ||
DB_DATABASE=homestead | ||
DB_USERNAME=homestead | ||
DB_PASSWORD=secret | ||
|
||
BROADCAST_DRIVER=log | ||
CACHE_DRIVER=file | ||
SESSION_DRIVER=file | ||
SESSION_LIFETIME=120 | ||
QUEUE_DRIVER=sync | ||
|
||
REDIS_HOST=127.0.0.1 | ||
REDIS_PASSWORD=null | ||
REDIS_PORT=6379 | ||
|
||
MAIL_DRIVER=smtp | ||
MAIL_HOST=smtp.mailtrap.io | ||
MAIL_PORT=2525 | ||
MAIL_USERNAME=null | ||
MAIL_PASSWORD=null | ||
MAIL_ENCRYPTION=null | ||
|
||
PUSHER_APP_ID= | ||
PUSHER_APP_KEY= | ||
PUSHER_APP_SECRET= | ||
PUSHER_APP_CLUSTER=mt1 | ||
|
||
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}" | ||
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" |
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,5 @@ | ||
* text=auto | ||
*.css linguist-vendored | ||
*.scss linguist-vendored | ||
*.js linguist-vendored | ||
CHANGELOG.md export-ignore |
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,14 @@ | ||
/node_modules | ||
/public/hot | ||
/public/storage | ||
/storage/*.key | ||
/vendor | ||
/.idea | ||
/.vscode | ||
/.vagrant | ||
Homestead.json | ||
Homestead.yaml | ||
npm-debug.log | ||
yarn-error.log | ||
.env | ||
.phpunit.result.cache |
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,12 @@ | ||
<?php | ||
|
||
namespace App; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
|
||
class Admin extends Model | ||
{ | ||
// | ||
protected $table = 'admin'; | ||
protected $primaryKey = 'id_admin'; | ||
} |
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,12 @@ | ||
<?php | ||
|
||
namespace App; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
|
||
class AdminAccess extends Model | ||
{ | ||
// | ||
protected $table = 'admin_access'; | ||
protected $primaryKey = 'id_access'; | ||
} |
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,12 @@ | ||
<?php | ||
|
||
namespace App; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
|
||
class AdminAccessMenu extends Model | ||
{ | ||
// | ||
protected $table = 'admin_access_menu'; | ||
protected $primaryKey = 'id_access'; | ||
} |
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,42 @@ | ||
<?php | ||
|
||
namespace App\Console; | ||
|
||
use Illuminate\Console\Scheduling\Schedule; | ||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel; | ||
|
||
class Kernel extends ConsoleKernel | ||
{ | ||
/** | ||
* The Artisan commands provided by your application. | ||
* | ||
* @var array | ||
*/ | ||
protected $commands = [ | ||
// | ||
]; | ||
|
||
/** | ||
* Define the application's command schedule. | ||
* | ||
* @param \Illuminate\Console\Scheduling\Schedule $schedule | ||
* @return void | ||
*/ | ||
protected function schedule(Schedule $schedule) | ||
{ | ||
// $schedule->command('inspire') | ||
// ->hourly(); | ||
} | ||
|
||
/** | ||
* Register the commands for the application. | ||
* | ||
* @return void | ||
*/ | ||
protected function commands() | ||
{ | ||
$this->load(__DIR__.'/Commands'); | ||
|
||
require base_path('routes/console.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,51 @@ | ||
<?php | ||
|
||
namespace App\Exceptions; | ||
|
||
use Exception; | ||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; | ||
|
||
class Handler extends ExceptionHandler | ||
{ | ||
/** | ||
* A list of the exception types that are not reported. | ||
* | ||
* @var array | ||
*/ | ||
protected $dontReport = [ | ||
// | ||
]; | ||
|
||
/** | ||
* A list of the inputs that are never flashed for validation exceptions. | ||
* | ||
* @var array | ||
*/ | ||
protected $dontFlash = [ | ||
'password', | ||
'password_confirmation', | ||
]; | ||
|
||
/** | ||
* Report or log an exception. | ||
* | ||
* @param \Exception $exception | ||
* @return void | ||
*/ | ||
public function report(Exception $exception) | ||
{ | ||
parent::report($exception); | ||
} | ||
|
||
/** | ||
* Render an exception into an HTTP response. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @param \Exception $exception | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function render($request, Exception $exception) | ||
{ | ||
return parent::render($request, $exception); | ||
} | ||
} |
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,12 @@ | ||
<?php | ||
|
||
namespace App; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
|
||
class Group extends Model | ||
{ | ||
// | ||
protected $table = 'group'; | ||
protected $primaryKey = 'id_group'; | ||
} |
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,158 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use Illuminate\Support\Facades\DB; | ||
|
||
use Illuminate\Http\Request; | ||
use App\Admin; | ||
use App\Group; | ||
use App\Http\Controllers\Controller; | ||
|
||
class AdminController extends Controller | ||
{ | ||
/** | ||
* Show the profile for the given user. | ||
* | ||
* @param int $id | ||
* @return View | ||
*/ | ||
public function index(Request $request) | ||
{ | ||
$status = $this->ceklogin($request,'/admin/list','/admin/list'); | ||
|
||
if($status['message'] == "error not logged in"){ | ||
return redirect('login?redirect_to='.$status['redirect_to']); | ||
} | ||
elseif($status['message'] == "error not have access"){ | ||
return redirect('/error/notauthorize'); | ||
} | ||
|
||
$data = array(); | ||
$data['logged_in'] = $request->session()->get('id_admin'); | ||
$data['dataAdmins'] = DB::table('admin as a') | ||
->join('group as g', 'a.id_group', '=', 'g.id_group') | ||
->select('a.*', 'g.group_name', 'a.id_admin') | ||
->get(); | ||
|
||
|
||
return view('admin.index',$data); | ||
} | ||
|
||
public function create(Request $request) | ||
{ | ||
$status = $this->ceklogin($request,'/admin/create','/admin/create'); | ||
|
||
if($status['message'] == "error not logged in"){ | ||
return redirect('login?redirect_to='.$status['redirect_to']); | ||
} | ||
elseif($status['message'] == "error not have access"){ | ||
return redirect('/error/notauthorize'); | ||
} | ||
|
||
$data = array(); | ||
$data['groups'] = Group::all()->toArray(); | ||
|
||
return view('admin.create', $data); | ||
} | ||
|
||
public function detail(Request $request,$id_admin) | ||
{ | ||
$status = $this->ceklogin($request,'/admin/list','/admin/detail/'.$id_admin); | ||
|
||
if($status['message'] == "error not logged in"){ | ||
return redirect('login?redirect_to='.$status['redirect_to']); | ||
} | ||
elseif($status['message'] == "error not have access"){ | ||
return redirect('/error/notauthorize'); | ||
} | ||
|
||
$data = array(); | ||
$data['dataAdmin'] = Admin::where(['id_admin' => $id_admin])->first()->toArray(); | ||
$data['groups'] = Group::all()->toArray(); | ||
|
||
return view('admin.detail', $data); | ||
} | ||
|
||
public function ajaxrequest(Request $request) | ||
{ | ||
$admin = new Admin; | ||
|
||
$response = array(); | ||
|
||
$post = $request->all(); | ||
|
||
if($post['process'] == "cekUsernameSave") | ||
{ | ||
|
||
} | ||
elseif($post['process'] == "save") | ||
{ | ||
$results = Admin::where(['username' => $post['username']])->get()->toArray(); | ||
|
||
if(count($results) > 0){ | ||
$response['status'] = 'error'; | ||
$response['message'] = 'Username Has Been Taken !'; | ||
}else{ | ||
$admin->display_name = $post['display_name']; | ||
$admin->username = $post['username']; | ||
$admin->password = $post['password']; | ||
$admin->id_group = $post['group']; | ||
|
||
$saved = $admin->save(); | ||
|
||
if(!$saved){ | ||
$response['status'] = 'error'; | ||
$response['message'] = 'something really bad has happend :('; | ||
}else{ | ||
$response['status'] = 'success'; | ||
$response['message'] = 'Data Saved !'; | ||
} | ||
} | ||
} | ||
elseif ($post['process'] == "update") | ||
{ | ||
$results = Admin::where(['username' => $post['username']])->whereNotIn('id_admin', [$post['id_admin']])->get()->toArray(); | ||
|
||
if(count($results) > 0){ | ||
$response['status'] = 'error'; | ||
$response['message'] = 'username has been taken by other admin !'; | ||
}else{ | ||
$adminUpdate = Admin::find($post['id_admin']); | ||
|
||
$adminUpdate->display_name = $post['display_name']; | ||
$adminUpdate->username = $post['username']; | ||
$adminUpdate->password = $post['password']; | ||
$adminUpdate->id_group = $post['group']; | ||
|
||
$saved = $adminUpdate->save(); | ||
|
||
if(!$saved){ | ||
$response['status'] = 'error'; | ||
$response['message'] = 'something really bad has happend :('; | ||
}else{ | ||
$response['status'] = 'success'; | ||
$response['message'] = 'Data Saved !'; | ||
} | ||
} | ||
} | ||
elseif ($post['process'] == "delete") | ||
{ | ||
$adminDelete = Admin::find($post['id_admin']); | ||
|
||
$saved = $adminDelete->delete(); | ||
|
||
if(!$saved){ | ||
$response['status'] = 'error'; | ||
$response['message'] = 'something really bad has happend :('; | ||
}else{ | ||
$response['status'] = 'success'; | ||
$response['message'] = 'Data Deleted !'; | ||
} | ||
} | ||
|
||
return json_encode($response); | ||
|
||
|
||
} | ||
} |
Oops, something went wrong.