Commit 09eea831 by Juliper

Profil sudah bisa dan add Kamar Role= Owner

parent 344e93f8
......@@ -62,7 +62,7 @@ class AdminController extends Controller
$owner->pekerjaan = '--';
$owner->noTelepon = '--';
$owner->noRekening = '--';
$owner->foto = 'img/gravatar.png';
$owner->foto = 'gravatar.png';
//dd($user);
$user->save();
......
......@@ -10,100 +10,32 @@ use Illuminate\Support\Facades\DB;
class OwnerController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
return view('adminlte::layouts.owner.home');
}
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);
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
//
}
public function editProfile($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);
}
public function updateProfile(Request $request, $id){
dd($request,$id);
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
//
......
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\User;
use App\Owner;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\MessageBag;
use Illuminate\Support\Facades\Input;
class ProfileController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
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);
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
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);
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(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');
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
//
}
}
<?php
namespace App\Http\Controllers;
use App\Room;
use Illuminate\Http\Request;
use App\User;
use App\Owner;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\MessageBag;
use Illuminate\Support\Facades\Input;
class RoomController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
return view('adminlte::layouts.owner.addRoom');
}
public function create()
{
//
}
public function listRoom(){
$i=1;
$data = Room::all();
$count = Room::all()->where('id_pemilik_homesaty',Auth::user()->id)->count();
return view('adminlte::layouts.owner.listRoom')->with('data',$data)->with('count',$count)->with('i',$i);
}
public function store(Request $request)
{
//dd($request['jumlah_bed'],$request['deskripsi']);
//$users = User::find(Auth::user()->id);
$room = new Room();
$room->id_pemilik_homesaty = Auth::user()->id;
$room->jumlah_bed = $request['jumlah_bed'];
$room->deskripsi = $request['deskripsi'];
$room->save();
return redirect('room');
}
public function show($id)
{
//
}
public function edit($id)
{
//
}
public function update(Request $request, $id)
{
//
}
public function destroy($id)
{
//
}
}
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Room extends Model
{
protected $table = "kamar";
protected $fillable = [
'id_pemilik_homestay', 'jumlah_bed', 'deskripsi',
];
public $timestamps = false;
}
@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">
<div class="panel-body">
<div class="row">
You Aare Here!!
Add Your Room and nice Description
<form action="{{ url('room') }}" method="post">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<br>
<label>Jumlah Bed</label>
<div class="form-group has-feedback">
<input type="text" class="form-control" placeholder="Jumlah Bed" name="jumlah_bed" />
<span class="fa fa-sort-numeric-asc form-control-feedback"></span>
</div>
<label>Dekripsi</label>
<div class="form-group has-feedback">
<input type="text" class="form-control" placeholder="Deskripsi" name="deskripsi"/>
<span class="fa fa-text-width form-control-feedback"></span>
</div>
<div class="col-xs-4 col-xs-push-8">
<button type="submit" class="btn btn-primary btn-block btn-flat">Tambah</button>
</div><!
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@endsection
\ No newline at end of file
@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 id="app">
@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>
@endif
<br>
<div class="col-md-4 col-sm-6 col-xs-12">
<div class="info-box bg-info">
<span class="info-box-icon bg-yellow"><i class="glyphicon glyphicon-modal-window"></i></span>
<div class="info-box-content">
<span class="info-box-text">List Room</span>
<span class="info-box-number">{{$count}}</span>
</div>
<!-- /.info-box-content -->
</div>
<!-- /.info-box -->
</div>
<br>
<table class="table table-striped">
<tr>
<th>No</th>
<th>Jumlah Bed</th>
<th>Deksripsi</th>
</tr>
@foreach($data as $a)
<td>{{$i++}}</td>
<td>{{$a->jumlah_bed}}</td>
<td>{{$a->deskripsi}}</td>
@endforeach
</table>
</div>
</div>
</div>
</div>
</div>
@endsection
......@@ -15,7 +15,7 @@
<div class="panel-body">
<div class="row">
<div class="col-md-3 col-lg-3" align="center">
<img alt="User Pic" src="{{$data->foto}}" class="img-circle img-responsive">
<img alt="User Pic" src="img/{{$data->foto}}" class="img-circle img-responsive">
</div>
<div class="col-md-9 col-lg-8">
<table class="table table-user-information">
......@@ -49,7 +49,7 @@
</div>
</div>
<div class="panel-footer">
<a href="{{url('profile/'.$data->id_Owner.'/profiledit')}}" data-original-title="Edit this user" data-toggle="tooltio" type="button" class="btn btn-sm btn-warning">
<a href="{{url('profile/'.$data->id.'/edit')}}" 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,12 +26,13 @@
</div>
@endif
<form action="{{url('profileUpdate/'.$data->id)}}" method="post" enctype="multipart/form-data"><input type="hidden" name="_method" value="PUT">
{{csrf_field()}}
<form action="{{url('profile/'.$data->id)}}" method="post" enctype="multipart/form-data">
<input type="hidden" name="_method" value="PUT">
{{csrf_field()}}
<label>Nama</label>
<input type="text" name="nama" value="{{$data->nama}}" id="nama" class="form-control">
<label>Alamat</label>
<input type="text" name="alamt" value="{{$data->alamat}}" id="alamat" class="form-control">
<input type="text" name="alamat" value="{{$data->alamat}}" id="alamat" class="form-control">
<label>Pekerjaan</label>
<input type="text" name="pekerjaan" value="{{$data->pekerjaan}}" id="pekerjaan" class="form-control">
<label>Nomor Telepon</label>
......
......@@ -39,8 +39,8 @@
<li><a href="{{url('listowner')}}"><i class='fa fa-list'></i> <span>{{ trans('adminlte_lang::message.listOwner') }}</span></a></li>
@elseif(Auth::user()->role=="Owner")
<li class="header">{{ trans('adminlte_lang::message.header') }}</li>
<li><a href="{{ url('room') }}"><i class='fa fa-plus'></i> <span>{{ trans('adminlte_lang::message.addRoom') }}</span></a></li>
<li><a href="{{ url('listRoom') }}"><i class='fa fa-list'></i> <span>{{ trans('adminlte_lang::message.addRoom') }}</span></a></li>
@endif
......
......@@ -34,5 +34,10 @@ Route::get('listowner','AdminController@listOwner');
Route::resource('owner','OwnerController');
route::get('profile','OwnerController@profile');
Route::get('profile/{id}/profiledit','OwnerController@editProfile');
Route::get('profileUpdate/{id}','OwnerController@updateProfile');
Route::get('profileUpdate/{id}','OwnerController@updatePro');
Route::resource('profile','ProfileController');
Route::resource('room','RoomController');
Route::get('listRoom','RoomController@listRoom');
......@@ -135,6 +135,7 @@ return [
'listOwner' => 'List Owner',
'profile' => 'Profile',
'namaHomestay' => 'Nama Homestay',
'addRoom' => 'Tambah Kamar',
];
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