getFolders(); $props=$this->getProps(); return view('web.bukjalar')->with([ 'title'=>'Mahabat Nyrhnama bukjalary', 'keywords'=>'', 'meta_description'=>'', 'folders'=>$folders, 'props'=>$props ]); } public function getFolders(){ $allFolders = Folder::all(); return $allFolders; } public function getProps(){ $allProps = PropertyType::all(); return $allProps; } /** * 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) { // $datas = $request->except('_token'); $time='Bukjada görkezizlen wagtlar!'; //dd($datas); $data=json_decode($datas['choices'],true); $bukjaOrder=new BukjaOrder(); foreach ($data as $val){ if (isset($val['customer'])){ $customer=$val['customer']; $customer_name=$customer['name']; $customer_email=$customer['email']; $customer_phone=$customer['phone']; $customer_notes=$customer['notes']; $bukjaOrder->customer_name=$customer_name; $bukjaOrder->customer_email=$customer_email; $bukjaOrder->customer_phone=$customer_phone; $bukjaOrder->customer_notes=$customer_notes; } } foreach ($data as $val){ if (isset($val['id'])){ $bukjaOrder=new BukjaOrder(); $bukjaOrder->customer_name=$customer_name; $bukjaOrder->customer_email=$customer_email; $bukjaOrder->customer_phone=$customer_phone; $bukjaOrder->customer_notes=$customer_notes; $order_id = $val['id']; $second=$val['second']; $folder_id=$val['folder_id']; $folder_name=$val['folder_name']; $day=$val['day']; $time=$val['time']; $total=$val['total']; $folder=Folder::find($folder_id); $order_prop=$folder->property->title; // $bukjaOrder->order_id=$order_id; $bukjaOrder->folder_id=$folder_id; $bukjaOrder->folder_name=$folder_name; $bukjaOrder->second=$second; $bukjaOrder->day=$day; $bukjaOrder->time=$time; $bukjaOrder->total=$total; $bukjaOrder->order_prop=$order_prop; $bukjaOrder->save(); } // if ($checked===true){ // return 'OrderSaved'; // } } } /** * 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) { // } /** * 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) { // } }