Commit 11aaa75f by Juliper

all to complete

parent 79527e8e
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Feedback extends Model
{
protected $table = "feedback";
protected $fillable = [
'id_pemilikHomestay', 'feedback', 'idPelanggan',
];
}
......@@ -2,6 +2,7 @@
namespace App\Http\Controllers;
use App\Feedback;
use App\Homestay;
use App\ListBook;
use App\Room;
......@@ -19,6 +20,34 @@ use Psy\Command\ListCommand\ConstantEnumerator;
class CustomerController extends Controller
{
public function sendFeedback(Request $request, $id){
if(Auth::guest()){
dd("maaf nggak bisa banf");
}
$dataPelanggan = DB::table('pelanggan')
->select('pelanggan.id')
->where('pelanggan.id_Akun','=',Auth::user()->id)
->get();
$dataPemilik = DB::table('homestay')
->select('homestay.idPemilik')
->where('homestay.id','=',$id)
->get();
//dd($dataPelanggan,$dataPemilik);
$feed = new Feedback();
$feed->id_pemilikHomestay = $dataPemilik[0]->idPemilik;
$feed->idPelanggan = $dataPelanggan[0]->id;
$feed->feedback = $request['feedback'];
$feed->save();
return redirect()->action('CustomerController@detailhomestay', ['id' => $id]);
//return redirect('detailhomestay/{id}',$id);
}
public function upload(Request $request,$id)
{
//dd("masuk agan");
......
......@@ -101,7 +101,7 @@ class OwnerController extends Controller
$dataKamar->fasilitas = $request['fasilitas'];
if($request->file('foto')==null){
$dataKamar->foto = $dataKamar->foto;
$dataKamar->gambar = $dataKamar->gambar;
}else{
$file = $request->file('foto');
$fileName = $file->getClientOriginalName();
......
......@@ -120,12 +120,12 @@
<div class="container">
<div class="col-md-6 col-sm-6 agileits w3layouts contact-grid contact-grid-2 wow slideInLeft">
<h2 style="margin-bottom: 10px;">Feedback</h2>
<form action="#" method="post" style="margin-bottom: 25px;"></form>
<form action="{{url('feedback/'.$data->id)}}" method="post" style="margin-bottom: 25px;">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<input type="text" class="text wow agileits w3layouts slideInLeft" name="Name" placeholder="Name" required="">
<textarea name="Message" class="wow agileits w3layouts slideInLeft" placeholder="Message" required=""></textarea>
<textarea name="feedback" class="wow agileits w3layouts slideInLeft" placeholder="Message" required=""></textarea>
<input type="submit" class="more_btn wow agileits w3layouts slideInLeft" value="Kirim Feedback">
</button>
</form>
</form>
</div>
</div>
</div>
......
......@@ -55,6 +55,7 @@ Route::get('DataPemesanan', function(){
return view('adminlte::layouts.admin.dataPemesanan');
});
Route::post('feedback/{id}','CustomerController@sendFeedback');
Route::get('listPemesanan','AdminController@listPesanan');
Route::put('editRoom/{id}','OwnerController@updateRoom');
Route::post('addManual','OwnerController@addBookManual');
......
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