Commit d7a28e19 by Juliper

all will be complete

parent 65128518
......@@ -22,6 +22,61 @@ class OwnerController extends Controller
return view('adminlte::layouts.owner.home');
}
public function updateProfil(Request $request,$id){
$owner = Owner::where('id',$id)->first();
$user = User::where('name',$owner->nama)->first();
//dd("masuk agan",$id,$request['picture'],$request['nama']);
if($request['nama']==""){
$user->name = $owner->nama;
}else{
$user->name = $request['nama'];
}
$owner->nama = $request['nama'];
$owner->alamat = $request['alamat'];
$owner->pekerjaan = $request['pekerjaan'];
$owner->noTelepon = $request['noTelepon'];
$owner->noRekening = $request['noRekening'];
if($request->file('picture')==null){
$owner->foto = $owner->foto;
}else{
$file = $request->file('picture');
$fileName = $file->getClientOriginalName();
$request->file('picture')->move("img/",$fileName);
$owner->foto = $fileName;
}
$user->update();
$owner->update();
//$data = DB::table('pemilikhomestay')->where('nama', $request['nama'])->first();
//dd('succes Gan');
return redirect('profile');
}
public function profileEdit($id){
$data = Owner::find($id);//all()->where('id_Owner',$id);
//dd($data);
return view('adminlte::layouts.owner.updateProfil')->with('data',$data);
}
public function profile(){
$users = User::find(Auth::user()->id);
//dd($users->name);
//$data = Owner::where('nama',$users->name);
$data = DB::table('pemilikhomestay')->where('nama', $users->name)->first();
//dd($data);
return view('adminlte::layouts.owner.profil')->with('data',$data);
}
public function feddback(){
$dataPemilik = DB::table('pemilikhomestay')
->select('pemilikhomestay.id')
......
......@@ -19,15 +19,7 @@ class ProfileController extends Controller
*/
public function index()
{
$users = User::find(Auth::user()->id);
//dd($users->name);
//$data = Owner::where('nama',$users->name);
$data = DB::table('pemilikhomestay')->where('nama', $users->name)->first();
//dd($data);
return view('adminlte::layouts.owner.profil')->with('data',$data);
}
/**
......@@ -71,9 +63,7 @@ class ProfileController extends Controller
public function edit($id)
{
//$users = User::find(Auth::user()->id);
$data = Owner::find($id);//all()->where('id_Owner',$id);
//dd($data);
return view('adminlte::layouts.owner.updateProfil')->with('data',$data);
}
/**
......
......@@ -39,7 +39,7 @@
<a class="agileits w3layoutswow slideInLeft" href="{{url('editProfileCustomer/'.$data->id)}}" >Edit Profile <span class="glyphicon agileits w3layouts glyphicon-arrow-right" aria-hidden="true"></span></a>
<a class="agileits w3layoutswow slideInLeft" href="{{url('history')}}">History <span class="glyphicon agileits w3layouts glyphicon-arrow-right" aria-hidden="true"></span></a>
<a class="agileits w3layoutswow slideInLeft" href="{{url('customerHistory')}}">History <span class="glyphicon agileits w3layouts glyphicon-arrow-right" aria-hidden="true"></span></a>
</div>
</div>
<div class="clearfix"></div>
......
......@@ -49,7 +49,7 @@
</div>
</div>
<div class="panel-footer">
<a href="{{url('profile/'.$data->id.'/edit')}}" data-original-title="Edit this user" data-toggle="tooltio" type="button" class="btn btn-sm btn-warning">
<a href="{{url('profiledit/'.$data->id)}}" data-original-title="Edit this user" data-toggle="tooltio" type="button" class="btn btn-sm btn-warning">
<i class="glyphicon glyphicon-edit"></i>
</a>
</div>
......
......@@ -26,7 +26,7 @@
</div>
@endif
<form action="{{url('profile/'.$data->id)}}" method="post" enctype="multipart/form-data">
<form action="{{url('profileupdate/'.$data->id)}}" method="post" enctype="multipart/form-data">
<input type="hidden" name="_method" value="PUT">
{{csrf_field()}}
<label>Nama</label>
......
......@@ -78,7 +78,7 @@
<!-- Menu Footer-->
<li class="user-footer">
<div class="pull-left">
<a href="{{ url('customerProfile') }}" class="btn btn-default btn-flat">{{ trans('adminlte_lang::message.profile') }}</a>
<a href="{{ url('profile') }}" class="btn btn-default btn-flat">{{ trans('adminlte_lang::message.profile') }}</a>
</div>
<div class="pull-right">
<a href="{{ url('/logout') }}" class="btn btn-default btn-flat"
......
......@@ -91,12 +91,15 @@ Route::put('requestFasilitas/{id}','AdminController@UpdateRequestFasilitas');
Route::put('requestFasilitass/{id}','AdminController@UpdateRequestFasilitass');
Route::put('listPengajuanHomestay/{id}','AdminController@AccPengajuanHomestay');
Route::resource('profile','ProfileController');
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('UpdateHomestay', function(){
......
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