Commit 9b062478 by Juliper

role acces Fix

parent 849bd2de
......@@ -18,6 +18,11 @@ use App\RequestFasilitas;
class AdminController extends Controller
{
public function __construct(){
$this->middleware('auth');
$this->middleware('dinaspariwisata');
}
public function index()
{
return view('adminlte::home');
......
......@@ -20,6 +20,11 @@ use Psy\Command\ListCommand\ConstantEnumerator;
class CustomerController extends Controller
{
public function __construct(){
$this->middleware('auth');
$this->middleware('customer');
}
public function cancelPemesanan($id){
$dataTrsaksi = Transaksi::find($id);
......
......@@ -17,6 +17,11 @@ use Illuminate\Support\Facades\DB;
class OwnerController extends Controller
{
public function __construct(){
$this->middleware('auth');
$this->middleware('owner');
}
public function index()
{
return view('adminlte::layouts.owner.home');
......
......@@ -2,6 +2,7 @@
namespace App\Http;
use App\Http\Middleware\DinasPariwisata;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
class Kernel extends HttpKernel
......@@ -52,5 +53,8 @@ class Kernel extends HttpKernel
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'dinaspariwisata' => \App\Http\Middleware\DinasPariwisata::class,
'customer' => \App\Http\Middleware\Customer::class,
'owner' => \App\Http\Middleware\Owner::class,
];
}
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Support\Facades\Auth;
class Customer
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if(Auth::check()){
if(Auth::user()->role !='Customer'){
dd('masuk');
if(Auth::user()->role == 'Owner'){
return redirect('owner');
}elseif(Auth::user()->role=='DinasPariwisata'){
return redirect('/home');
}else{
return redirect('');
}
}
}else{
return redirect('');
}
return $next($request);
}
}
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Support\Facades\Auth;
class DinasPariwisata
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if(Auth::check()){
if(Auth::user()->role != 'DinasPariwisata'){
if(Auth::user()->role =='Owner'){
return redirect('owner');
}else if(Auth::user()->role=='Customer'){
return redirect('');
}else{
return redirect('/home');
}
}
}
return $next($request);
}
}
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Support\Facades\Auth;
class Owner
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if(Auth::check()){
if(Auth::user()->role != 'Owner'){
dd('masuk');
if(Auth::user()->role == 'Customer'){
return redirect('');
}elseif(Auth::user()->role == 'DinasPariwisata'){
return redirect('/');
}else{
return redirect('owner');
}
}
}
return $next($request);
}
}
......@@ -55,55 +55,72 @@ Route::get('DataPemesanan', function(){
return view('adminlte::layouts.admin.dataPemesanan');
});
Route::post('feedback/{id}','CustomerController@sendFeedback');
Route::get('listPemesanan','AdminController@listPesanan');
Route::put('editRoom/{id}','OwnerController@updateRoom');
Route::post('addManual','OwnerController@addBookManual');
Route::put('konfirmasiPemesanan/{id}','OwnerController@konfirmasiPemesanan');
Route::get('editRoom/{id}','OwnerController@editRoom') ;
Route::get('daftarBooking','OwnerController@listOfBook');
Route::get('daftarKamar','OwnerController@daftarKamar');
Route::get('pesanan','OwnerController@listTransaction');
Route::put('upload/{id}','CustomerController@upload');
Route::get('detailhomestay/{id}','CustomerController@detailhomestay');
Route::get('customerHistory','CustomerController@history');
Route::get('daftar','CustomerController@register');
Route::post('daftar','CustomerController@registerStore');
Route::post('book','CustomerController@booking');
Route::get('buktipembayaran/{id}','CustomerController@bukti');
Route::get('editProfileCustomer/{id}','CustomerController@editProfile');
Route::put('editProfileCustomer/{id}','CustomerController@updateProfile');
Route::resource('admin', 'AdminController');
Route::get('listowner','AdminController@listOwner');
Route::resource('owner','OwnerController');
Route::get('customerProfile','CustomerController@profile');
route::get('profile','OwnerController@profile');
Route::get('profile/{id}/profiledit','OwnerController@editProfile');
Route::get('profileUpdate/{id}','OwnerController@updatePro');
Route::get('requestHomestay','AdminController@RequestHomestay');
Route::get('requestFasilitas','AdminController@RequestFasilitas');
Route::get('pengajuanHomestay','OwnerController@pengajuan');
Route::post('pengajuanHomestay','OwnerController@storePengajuan');
Route::get('listPengajuan','OwnerController@listPengajuan');
Route::get('listPengajuanFasilitas','OwnerController@listPengajuanFasilitas');
Route::put('requestFasilitas/{id}','AdminController@UpdateRequestFasilitas');
Route::put('requestFasilitass/{id}','AdminController@UpdateRequestFasilitass');
Route::put('listPengajuanHomestay/{id}','AdminController@AccPengajuanHomestay');
Route::get('reqFasilitas','OwnerController@requestFasilitas');
Route::post('reqFasilitas','OwnerController@storeRequest');
Route::get('updateHomestay','OwnerController@update');
Route::put('updateHomestay/{id}','OwnerController@updateHomestay');
Route::delete('batalkanPemesanan/{id}','CustomerController@cancelPemesanan');
Route::get('profile','OwnerController@profile');
Route::get('profiledit/{id}','OwnerController@profileEdit');
Route::put('profileupdate/{id}','OwnerController@updateProfil');
Route::group(['middleware' => 'owner'], function () {
Route::put('editRoom/{id}','OwnerController@updateRoom');
Route::post('addManual','OwnerController@addBookManual');
Route::put('konfirmasiPemesanan/{id}','OwnerController@konfirmasiPemesanan');
Route::get('editRoom/{id}','OwnerController@editRoom') ;
Route::get('daftarBooking','OwnerController@listOfBook');
Route::get('daftarKamar','OwnerController@daftarKamar');
Route::get('pesanan','OwnerController@listTransaction');
Route::get('reqFasilitas','OwnerController@requestFasilitas');
Route::post('reqFasilitas','OwnerController@storeRequest');
Route::get('updateHomestay','OwnerController@update');
Route::put('updateHomestay/{id}','OwnerController@updateHomestay');
Route::delete('batalkanPemesanan/{id}','CustomerController@cancelPemesanan');
Route::get('profile','OwnerController@profile');
Route::get('profiledit/{id}','OwnerController@profileEdit');
Route::put('profileupdate/{id}','OwnerController@updateProfil');
route::get('profile','OwnerController@profile');
Route::get('profile/{id}/profiledit','OwnerController@editProfile');
Route::get('profileUpdate/{id}','OwnerController@updatePro');
Route::resource('owner','OwnerController');
Route::get('pengajuanHomestay','OwnerController@pengajuan');
Route::post('pengajuanHomestay','OwnerController@storePengajuan');
Route::get('listPengajuan','OwnerController@listPengajuan');
Route::get('listPengajuanFasilitas','OwnerController@listPengajuanFasilitas');
Route::get('listFeedback','OwnerController@feddback');
});
Route::group(['middleware' => 'customer'], function () {
Route::put('upload/{id}','CustomerController@upload');
Route::get('detailhomestay/{id}','CustomerController@detailhomestay');
Route::get('customerHistory','CustomerController@history');
Route::get('daftar','CustomerController@register');
Route::post('daftar','CustomerController@registerStore');
Route::post('book','CustomerController@booking');
Route::get('buktipembayaran/{id}','CustomerController@bukti');
Route::get('editProfileCustomer/{id}','CustomerController@editProfile');
Route::put('editProfileCustomer/{id}','CustomerController@updateProfile');
Route::get('customerProfile','CustomerController@profile');
Route::post('feedback/{id}','CustomerController@sendFeedback');
});
Route::group(['middleware' => 'dinaspariwisata'], function () {
Route::resource('admin', 'AdminController');
Route::get('listowner','AdminController@listOwner');
Route::get('listPemesanan','AdminController@listPesanan');
Route::get('requestHomestay','AdminController@RequestHomestay');
Route::get('requestFasilitas','AdminController@RequestFasilitas');
Route::put('requestFasilitas/{id}','AdminController@UpdateRequestFasilitas');
Route::put('requestFasilitass/{id}','AdminController@UpdateRequestFasilitass');
Route::put('listPengajuanHomestay/{id}','AdminController@AccPengajuanHomestay');
});
/*Route::get('UpdateHomestay', function(){
return view('adminlte::layouts.owner.UpdateHomestay');
});*/
Route::get('listFeedback','OwnerController@feddback');
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