public function contact_us(Request $request) { if ($request->all()) { $rules = array('name' => 'required', 'email' => 'required|email', 'type' => 'required', 'message' => 'required'); $validator = Validator::make($request->all(), $rules); if (!$validator->fails()) { $ask = new Ask(); $ask->name = $request->input('name'); $ask->email = $request->input('email'); $ask->type = $request->input('type'); $ask->ask = $request->input('message'); $ask->status = 0; if ($ask->save()) { return redirect('contact')->with('success', 'Pesan anda telah dikirimkan, kami akan membalas pesan anda secepatnya'); } } else { return redirect('contact')->with('error', 'harap isi semua form'); } } else { $this->data['css_assets'] = Assets::load('css', ['lib-bootstrap', 'style', 'font-awesome', 'font-awesome-min', 'flexslider', 'color-schemes-core', 'color-schemes-turquoise', 'jquery-parallax', 'bootstrap-responsive', 'font-family']); $this->data['js_assets'] = Assets::load('js', ['jquery', 'jquery-ui', 'jquery-easing', 'bootstrap-min-lib', 'jquery-isotope', 'jquery-flexslider', 'jquery.elevatezoom', 'jquery-sharrre', 'jquery-gmap3', 'imagesloaded', 'la_boutique', 'jquery-cookie', 'jquery-parallax-lib']); $this->data['title'] = 'Kontak Kami'; return view('main_layout')->with('data', $this->data)->nest('content', 'contact_us', array('data' => $this->data)); } }
public function ask_product(Request $request) { $user = Sentinel::getUser(); $product = Product::where('id', $request->product_id)->first(); $ask = new Ask(); if ($user->first_name != '') { $ask->name = ucwords($user->first_name) . " " . ucwords($user->last_name); } else { $ask->name = "guest"; } $ask->email = $request->email; $ask->type = "pertanyaan"; $ask->ask = "Produk " . ucwords($product->name) . " - " . $request->message; $ask->status = 0; $ask->save(); }
<?php use App\Http\Models\Ask; use App\Http\Models\Order; $data['mailCount'] = Ask::where('status', 0)->count(); $data['mail'] = Ask::where('status', 0)->orderBy('id', 'DESC')->get(); $data['paymentCount'] = Order::where('order_status', 'Telah Dibayar')->count(); $data['readyCount'] = Order::where('no_resi', '')->where('order_status', 'Lunas')->count(); $data['notifCount'] = $data['paymentCount'] + $data['readyCount']; $now = Date("Y-m-d H:i:s"); $now = new DateTime($now); ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="csrf-token" content="{!! csrf_token() !!}"/> <title>{!! $data['title'] !!}</title> <!-- Tell the browser to be responsive to screen width --> <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"> <link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css"> <?php // ============ CSS ============ ?> <!-- Ionicons --> <!-- <link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css"> -->
public function delete_message($id) { $message = Ask::find($id); if (!$message) { return redirect('master/message/list')->with('error', 'Data tidak ada'); } if ($message->status == 0) { return redirect('master/message/list')->with('error', 'Tidak dapat menghapus pesan yang belum dibaca'); } else { $message->delete(); return redirect('master/message/list')->with('success', 'Pesan telah dihapus'); } }