Commit 89cada2f by Juliper

no message

parent 6ae25060
......@@ -33,6 +33,49 @@ class AdminController extends Controller
return view('adminlte::layouts.admin.listOwner')->with('data',$data)->with('count',$count);
}
public function owner($id){
$data = Owner::where('id_akun',$id)->get();
// dd($data[0]);
return view('adminlte::layouts.admin.updateOwner')->with('data',$data[0]);
}
public function rincian($id){
$dataPem = DB::table('pemilikhomestay')
->where('pemilikhomestay.id_akun','=',$id)
->get();
$data = Owner::find($dataPem[0]->id);
return view('adminlte::layouts.admin.profil')->with('data',$data);
}
public function updateOwner(Request $request, $id){
$dataOw = Owner::find($id);
$dataOw->nama ;
$dataOw->alamat;
$dataOw->pekerjaan;
$dataOw->no_telepon;
$dataOw->no_rekening;
//dd('aman',$dataOw->id_akun);
$dataUs = User::find($dataOw->id_akun);
$dataUs->username = $request['username'];
$dataUs->password = bcrypt($request['password']);
//dd($dataUs);
$dataUs->update();
return redirect('listowner');
//dd($dataOw->id);
}
//Mengakses Daftar Pemesanan
public function listPesanan(){
......@@ -48,11 +91,8 @@ class AdminController extends Controller
public function listOwner(){
$count = User::all()->where('role',"Owner")->count();
$data = User::all()->where('role',"Owner");
//dd($data);
return view('adminlte::layouts.admin.listOwner')->with('data',$data)->with('count',$count);
}
//Menambah owner
......
......@@ -13,6 +13,7 @@ use App\User;
use App\Owner;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\View;
class OwnerController extends Controller
{
......@@ -24,37 +25,6 @@ class OwnerController extends Controller
public function index()
{
//coba
// $dataPemilik = DB::table('pemilikhomestay')
// ->select('pemilikhomestay.*')
// ->where('pemilikhomestay.id_akun','=',Auth::user()->id)
// ->get();
//
// $data = DB::table('homestay')
// ->join('pemilikhomestay','homestay.id_pemilik','pemilikhomestay.id')
// ->join('kamar','homestay.id','=','kamar.id_homestay')
// ->select('kamar.*')
// ->where('pemilikhomestay.id','=',$dataPemilik[0]->id)
// ->get();
//
// $dataHomestay = DB::table('homestay')
// ->join('pemilikhomestay','homestay.id_pemilik','pemilikhomestay.id')
// ->select('homestay.id')
// ->where('pemilikhomestay.id','=',$dataPemilik[0]->id)
// ->get();
//
// $dataListOfBook = DB::table('daftar_book')
// ->select('daftar_book.*')
// ->where('daftar_book.homestay','=',$dataHomestay[0]->id)
// ->get();
//
// $dataFeedback = DB::table('feedback')
// ->join('pelanggan','feedback.id_pelanggan','pelanggan.id')
// ->select('feedback.*','pelanggan.nama')
// ->where('feedback.id_pemilik_homestay','=',$dataPemilik[0]->id)
// ->get();
//coba
$dataPel = DB::table('pemilikhomestay')
->select('pemilikhomestay.*')
->where('pemilikhomestay.id_akun','=',Auth::user()->id)
......
......@@ -36,7 +36,7 @@
<form action="{{ url('/login') }}" method="post">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<div class="form-group has-feedback">
<input type="text" class="form-control" placeholder="username" name="username"/>
<input type="text" class="form-control" placeholder="Username" name="username"/>
<span class="glyphicon glyphicon-user form-control-feedback"></span>
</div>
<div class="form-group has-feedback">
......
......@@ -26,12 +26,24 @@
<th>Name</th>
<th>Username</th>
<th>Email</th>
<th></th>
<th></th>
</tr>
@foreach($data as $a)
<tr>
<td>{{$a->name}}</td>
<td>{{$a->username}}</td>
<td>{{$a->email}}</td>
<td>
<form action="{{url('rincianpemilik/'.$a->id)}}">
<input type="submit" value="Rincian">
</form>
</td>
<td>
<form action="{{url('ownerr/'.$a->id)}}">
<input type="submit" value="perbaharui">
</form>
</td>
</tr>
@endforeach
......
@extends('adminlte::layouts.app')
@section('htmlheader_title')
{{ trans('adminlte_lang::message.home') }}
@endsection
@section('main-content')
<div class="container-fluid spark-screen">
<div class="row">
<div class="col-md-10 col-md-offset-1">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-heading">{{$data->nama}}</h3>
</div>
<div class="panel-body">
<div class="row">
<div class="col-md-3 col-lg-3" align="center">
<img alt="User Pic" src="/img/{{$data->foto}}" style="width: 200px; border-radius:10%;">
</div>
<div class="col-md-9 col-lg-8">
<table class="table table-user-information">
<tr>
<th>Alamat </th>
<td>: </td>
<td>{{$data->alamat}}</td>
</tr>
<tr>
<th>Perkerjaan</th>
<td>: </td>
<td>{{$data->pekerjaan}}</td>
</tr>
<tr>
<th>No Telepon</th>
<td>: </td>
<td>{{$data->no_telepon}}</td>
</tr>
<tr>
<th>No Rekening </th>
<td>: </td>
<td>{{$data->no_rekening}}</td>
</tr>
</table>
</div>
</div>
</div>
</div>
@endsection
</div>
</div>
</div>
@extends('adminlte::layouts.app')
@section('htmlheader_title')
{{ trans('adminlte_lang::message.home') }}
@endsection
@section('main-content')
<div class="box box-primary">
<div class="box-header with-border">
<h3 class="box-title"> UPDATE PROFIL</h3>
@if (count($errors) > 0)
<div class="alert alert-danger">
<strong>Whoops!</strong> {{ trans('adminlte_lang::message.someproblems') }}<br><br>
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@if(session()->has('message'))
<div class="alert alert-info">
{{session()->get('message')}}
</div>
@endif
@endif
</div>
<div class="box-body">
<form action="{{ url('updateOwner/'.$data->id) }}" method="post" enctype="multipart/form-data">
<input type="hidden" name="_method" value="PUT">
{{csrf_field()}}
<div class="form-group">
<label> Nama </label>
<div class="input-group">
<div class="input-group-addon">
<i class="fa fa-bookmark"></i>
</div>
<input type="text" class="form-control" placeholder="nama" name="nama" value="{{$data->nama}}"/>
</div>
</div>
<div class="form-group">
<label> Alamat </label>
<div class="input-group">
<div class="input-group-addon">
<i class="fa fa-building"></i>
</div>
<input type="text" class="form-control" placeholder="Alamat" name="alamat" value="{{$data->alamat}}"/>
</div>
</div>
<div class="form-group">
<label> Perkerjaan </label>
<div class="input-group">
<div class="input-group-addon">
<i class="fa fa-dollar"></i>
</div>
<input type="text" class="form-control" value="{{$data->pekerjaan}}" name="pekerjaan"/>
</div>
</div>
<div class="form-group">
<label> No Telepon </label>
<div class="input-group">
<div class="input-group-addon">
<i class="fa fa-dollar"></i>
</div>
<input type="Number" class="form-control" value="{{$data->no_telepon}}" placeholder="noTelepon" name="noTelepon"/>
</div>
</div>
<div class="form-group">
<label>No Rekening </label>
<div class="input-group">
<div class="input-group-addon">
<i class="fa fa-dollar"></i>
</div>
<input type="Number" class="form-control" value="{{$data->no_rekening}}" placeholder="noRekening" name="noRekening"/>
</div>
</div>
<div class="form-group">
<label>Username</label>
<div class="input-group">
<div class="input-group-addon">
<input type="text" name="username" class="form-control" placeholder="Username">
</div>
</div>
</div>
<div class="form-group">
<label>Password</label>
<div class="input-group">
<div class="input-group-addon">
<input type="password" name="password" class="form-control" placeholder="Password">
</div>
</div>
</div>
<div class="form-group" align="right" style="color: black;">
<button type="submit" class="btn btn-primary ">Update</button>
</div>
</form>
</div>
</div>
@endsection
......@@ -103,6 +103,9 @@ Route::group(['middleware' => 'customer'], function () {
Route::group(['middleware' => 'dinaspariwisata'], function () {
Route::resource('admin', 'AdminController');
Route::put('updateOwner/{id}','AdminController@updateOwner');
Route::get('ownerr/{id}','AdminController@owner');
Route::get('rincianpemilik/{id}','AdminController@rincian');
Route::get('listowner','AdminController@listOwner');
Route::get('listPemesanan','AdminController@listPesanan');
Route::get('requestHomestay','AdminController@RequestHomestay');
......
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