Commit 344e93f8 by Juliper

update profil

parent 3d90ab1a
......@@ -7,6 +7,7 @@ use App\User;
use Validator;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\RegistersUsers;
use App\Owner;
class AdminController extends Controller
{
......@@ -55,10 +56,18 @@ class AdminController extends Controller
$user->password = bcrypt($data['password']);
$user->role = 'Owner';
$owner = new Owner();
$owner->nama = $data['name'];
$owner->alamat = '--';
$owner->pekerjaan = '--';
$owner->noTelepon = '--';
$owner->noRekening = '--';
$owner->foto = 'img/gravatar.png';
//dd($user);
$user->save();
$owner->save();
//dd("berhasil agan");
return redirect(url('admin/create'))->with('info', 'User berhasil ditambah ');
}
......
......@@ -3,6 +3,10 @@
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\User;
use App\Owner;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
class OwnerController extends Controller
{
......@@ -17,7 +21,15 @@ class OwnerController extends Controller
}
public function profile(){
return view('adminlte::layouts.owner.profil');
$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.
......@@ -62,6 +74,19 @@ class OwnerController extends Controller
//
}
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.
*
......@@ -71,7 +96,6 @@ class OwnerController extends Controller
*/
public function update(Request $request, $id)
{
//
}
/**
......
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Owner extends Model
{
protected $table = "pemilikhomestay";
protected $fillable = [
'nama', 'alamat', 'pekerjaan','noTelepon','noRekening','foto',
];
}
......@@ -15,17 +15,41 @@
<div class="panel-body">
<div class="row">
<div class="col-md-3 col-lg-3" align="center">
<img alt="User Pic" src="img/gravatar.png" class="img-circle img-responsive">
<img alt="User Pic" src="{{$data->foto}}" class="img-circle img-responsive">
</div>
<div class="col-md-9 col-lg-9">
<div class="col-md-9 col-lg-8">
<table class="table table-user-information">
<tr>
<th>Nama </th>
<td>: </td>
<td>{{$data->nama}}</td>
</tr>
<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->noTelepon}}</td>
</tr>
<tr>
<th>No Rekening </th>
<td>: </td>
<td>{{$data->noRekening}}</td>
</tr>
</table>
</div>
</div>
</div>
<div class="panel-footer">
<a href="" data-original-title="Edit this user" data-toggle="tooltio" type="button" class="btn btn-sm btn-warning">
<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">
<i class="glyphicon glyphicon-edit"></i>
</a>
</div>
......
@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-body">
@if(Session::has('alert-success'))
<div class="alert alert-success">
{{ Session::get('alert-success') }}
</div>
@endif
@if (count($errors) > 0)
<div class="alert alert-danger">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<form action="{{url('profileUpdate/'.$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">
<label>Pekerjaan</label>
<input type="text" name="pekerjaan" value="{{$data->pekerjaan}}" id="pekerjaan" class="form-control">
<label>Nomor Telepon</label>
<input type="text" name="noTelepon" value="{{$data->noTelepon}}" id="noTelepon" class="form-control">
<label>Nomor Rekening</label>
<input type="text" name="noRekening" value="{{$data->noRekening}}" id="noRekening" class="form-control">
<label>Foto</label>
<input type="file" name="picture" id="picture" class="form-control"><br>
<div class="form-group" align="right">
<input type="submit" class="btn btn-primary" value="simpan">
</div>
</form>
</div>
</div>
</div>
</div>
</div>
@endsection
\ No newline at end of file
......@@ -78,7 +78,7 @@
<!-- Menu Footer-->
<li class="user-footer">
<div class="pull-left">
<a href="{{ url('/settings') }}" 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"
......
......@@ -40,7 +40,6 @@
@elseif(Auth::user()->role=="Owner")
<li class="header">{{ trans('adminlte_lang::message.header') }}</li>
<li><a href="{{ url('profile') }}"><i class='glyphicon glyphicon-user'></i> <span>{{ trans('adminlte_lang::message.profile') }}</span></a></li>
@endif
......
......@@ -33,4 +33,6 @@ Route::resource('admin', 'AdminController');
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');
......@@ -134,6 +134,7 @@ return [
'username' => 'Username',
'listOwner' => 'List Owner',
'profile' => 'Profile',
'namaHomestay' => 'Nama Homestay',
];
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