<?php namespace App\Http\Controllers; use App\Homestay; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; use App\User; use App\Customer; use Illuminate\Support\Facades\DB; use Illuminate\Contracts\Auth\Guard; class CustomerController extends Controller { public function profile(){ //dd("masuk agan"); //dd(Auth::user()->id); $data = DB::table('pelanggan') ->select('pelanggan.*') ->where('pelanggan.id_Akun','=',Auth::user()->id) ->get(); //$data2 = User::find(Auth::user()->id); //dd($data[0]); return view('adminlte::layouts.customers.profiles')->with('data',$data[0]); } public function register(){ return view('adminlte::auth.register'); } public function registerStore(Request $data){ $user = new User(); $user->name = $data['name']; $user->username = $data['username']; $user->email = $data['email']; $user->password = bcrypt($data['password']); $user->role = "Customer"; $user->foto = "gravatar.png"; $user->save(); $dataPel = DB::table('users') ->select('users.id') ->where('users.username','=',$data['username']) ->get(); $cus = new Customer(); $cus->id_Akun = $dataPel[0]->id; $cus->nama = $data['name'] ; $cus->alamat = "---"; $cus->noTelepon = "---"; $cus->pekerjaan = "---"; $cus->save(); //$this->guard()->login($user); return redirect('login'); } public function editProfile($id){ $data = Customer::find($id); //dd($data); return view('adminlte::layouts.customers.editprofiles')->with('data',$data); } public function detailhomestay($id){ $data = DB::table('homestay') ->join('pemilikhomestay','homestay.idPemilik','=','pemilikhomestay.id') ->select('pemilikhomestay.*','homestay.*') ->where('homestay.id','=',$id) ->get(); //dd($data); return view('adminlte::layouts.pages.Homestay')->with('data',$data[0]); } public function updateProfile(Request $request,$id){ $cus = Customer::find($id); dd("masuk agan",$id); } }