public function inbox() { $name = \Auth::user()->name; $results = \DB::select('select * from notification.inbox_' . $name . ' order by created_at desc limit 70 offset 0'); \DB::update('update notification.inbox_' . $name . ' set n_read = true'); return view('profile.inbox')->with('results', $results); }
/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(Request $request, $id) { $products = \App\Cart::where('product_id', $id); for ($i = 0; $i <= count($products); $i++) { $product = \App\Product::where('product_id', $products[$i]['product_id'])->first(); $newstock = $product['stock'] - $products[$i]['amount']; DB::update('update tbl_products set stock = ? where product_id = ?', array($newstock, $product['product_id'])); } // return redirect('products')->with('message', 'payment succesfully'); }
public function approveEditRequest($id) { $result = \DB::select('SELECT * FROM `store_edit_requests` WHERE id=?', [$id]); $result = $result[0]; try { \DB::update("UPDATE stores SET `{$result->key}` = '{$result->value}' WHERE id={$result->store_id}"); } catch (\Exception $e) { \DB::insert("INSERT INTO `store_metas` (`id`, `store_id`, `key`, `value`, `created_at`, `updated_at`) VALUES (NULL, ?, ?, ?, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)", [$result->store_id, $result->key, $result->value]); } \DB::update('UPDATE `store_edit_requests` SET approved=1 WHERE id=?', [$id]); }
public function insert_robi_ticket() { date_default_timezone_set('Asia/Dhaka'); $escalation_time = date('Y/m/d h:i:s a', time()); //secho $date; $client_id = $_SESSION['TICKET_USER_CLIENT_ID']; $client_type = $_SESSION['TICKET_USER_CLIENT_TYPE']; // $client_priority = Request::get('client_priority'); // $link_type = Request::get('link_type'); $problem_category = Request::get('problem_category'); $problem_source = Request::get('problem_source'); // $region = Request::get('region'); $district = Request::get('district'); // $reason = Request::get('reason'); $event_time = Request::get('event_time'); $link_name = Request::get('link_name'); $client_impact = Request::get('client_impact'); $client_site_count = Request::get('client_site_count'); // $vendor_site_count = Request::get('vendor_site_count'); // $vendor_impact = Request::get('vendor_impact'); $remarks = Request::get('remarks'); // $ticket_status = Request::get('ticket_status'); // $responsible_vendor = Request::get('responsible_vendor'); // $responsible_concern = Request::get('responsible_concern'); // $responsible_field_team = Request::get('responsible_field_team'); $query_insert_robi_ticket = "INSERT INTO ticket_table (client_id,client_type,client_priority,link_type,problem_category,problem_source,region,district,reason,event_time,escalation_time,link_name,client_impact,client_site_count,vendor_site_count, vendor_impact, remarks,ticket_status,responsible_vendor,responsible_concern,responsible_field_team,attachment_path) values ('" . $client_id . "','" . $client_type . "','NULL','NULL','" . $problem_category . "','" . $problem_source . "','NULL','" . $district . "','NULL','" . $event_time . "','" . $escalation_time . "','" . $link_name . "','" . $client_impact . "','" . $client_site_count . "','NULL','NULL','" . $remarks . "','open','NULL','NULL','NULL','NULL');"; \DB::insert(\DB::raw($query_insert_robi_ticket)); $result_list = \DB::select(\DB::raw("SELECT ticket_table_row_id FROM ticket_table ORDER BY ticket_table_row_id DESC limit 1")); foreach ($result_list as $result) { $ticket_table_row_id = $result->ticket_table_row_id; } if (Input::hasFile('attachment_path')) { // $path_test = '../Uploaded_Files/'.$ticket_table_row_id; // if(File::exists($path_test)) // { // File::delete($path_test); // } $dirPath = '../Uploaded_Files/'; $files = Input::file('attachment_path'); foreach ($files as $file) { // $filename = "test.txt"; // $file->move($dirPath,$filename); $filename = $file->getClientOriginalName(); $file->move($dirPath, $filename); } } $attachment_path = 'uploaded_files/' . $ticket_table_row_id; $ticket_update_querystring = "UPDATE ticket_table SET attachment_path='" . $attachment_path . "',ticket_id='" . $ticket_table_row_id . "' WHERE ticket_table_row_id='" . $ticket_table_row_id . "'"; \DB::update(\DB::raw($ticket_update_querystring)); }
public function SubmitScore(Requests\ScoreEntryRequest $request) { $input = $request->all(); \DB::$user = '******'; \DB::$password = '******'; \DB::$dbName = 'Euro2016'; $row = \DB::queryFirstRow("select * from Scores where MatchID = %i and UserID = %i", $request->matchid, Auth::user()->id); $count = \DB::count(); if ($count == 0) { \DB::insert('Scores', array('MatchID' => $request->matchid, 'UserID' => Auth::user()->id, 'CountryHome' => $request->CountryHomeScore, 'CountryAway' => $request->CountryAwayScore)); } else { \DB::update('Scores', array('CountryHome' => $request->CountryHomeScore, 'CountryAway' => $request->CountryAwayScore), "ID=%i", $row['ID']); } \DB::disconnect(); return json_encode($input); }
public function destroy($id) { $sql = \DB::update("UPDATE sampling SET analysis_id = NULL where analysis_id = " . $id); $analysis = Analysis::findOrFail($id); $analysis->delete($id); Session::flash('message', 'fue eliminado de nuestros registros.'); return redirect()->route('analisis.index'); }
public function view() { $results = \DB::select('select * from public.arduino where v_read = false order by created_at desc limit 50 offset 0'); \DB::update('update public.arduino set v_read = true'); return view('arduino.arduview')->with('results', $results); }
public function SubmitScoreFinal(Requests\ScoreEntryFinalRequest $request) { $input = $request->all(); \DB::$user = '******'; \DB::$password = '******'; \DB::$dbName = 'Euro2016'; $row = \DB::queryFirstRow("select * from Scores where MatchID = %i and UserID = %i", $request->matchid, Auth::user()->id); $count = \DB::count(); //Log::info($count.' '.$request->matchid); \DB::startTransaction(); if ($count == 0) { \DB::insert('Scores', array('MatchID' => $request->matchid, 'UserID' => Auth::user()->id, 'CountryHome' => $request->CountryHomeScore, 'CountryAway' => $request->CountryAwayScore)); } else { \DB::update('Scores', array('CountryHome' => $request->CountryHomeScore, 'CountryAway' => $request->CountryAwayScore), "ID=%i", $row['ID']); } $affectedcount = \DB::affectedRows(); \DB::update('Matches', array('CountryHomeID' => $request->CountryHomeID, 'CountryAwayID' => $request->CountryAwayID), "MatchID=%i", $request->matchid); \DB::commit(); \DB::disconnect(); // retrieve country names and flag $countrynamehome = \DB::queryFirstRow("select CountryName, Flag from Countries where CountryID = %i", $request->CountryHomeID); $countrynameaway = \DB::queryFirstRow("select CountryName, Flag from Countries where CountryID = %i", $request->CountryAwayID); $input['CountryHomeID'] = $countrynamehome['CountryName']; $input['CountryAwayID'] = $countrynameaway['CountryName']; $input['CountryHomeImage'] = $countrynamehome['Flag']; $input['CountryAwayImage'] = $countrynameaway['Flag']; //$input['CountryHID'] = $request->CountryHomeID; //$input['CountryAID'] = $request->CountryAwayID; return json_encode($input); }
public function check() { @($key = strip_tags(\Route::input('key'))); if (empty($key)) { return redirect('/'); } else { $result = \DB::table('post')->where('post_key', $key)->first(); if (isset($result->id)) { if ($result->post_state == 1) { $exp = explode('_', $result->facebook_url); $url = 'https://facebook.com/' . $exp[0] . '/posts/' . $exp[1]; return redirect($url); } else { if ($result->publish_time - time() >= 0) { $state = '<div class="alert alert-danger text-center" role="alert">' . \Lang::get('check.do_not_close_window') . '</div><h4>' . \Lang::get('check.remaining_time') . ': <span id="countdown" data-timestamp="' . $result->publish_time . '"></span></h4><p>' . \Lang::get('check.auto_redirect_message') . '</p>'; $foot = '<script src="/js/check.js" type="text/javascript"></script>'; } elseif ($result->publish_time - time() < 0 && $result->post_state == 0) { $last = \DB::table('post')->where('post_state', '1')->orderBy('id', 'desc')->first(); if (count($last) > 0) { $query = 'UPDATE post SET post_state = 8 WHERE id < ' . $last->id . ' AND post_state = 0'; \DB::update(\DB::raw($query)); } $this->publishPostToFacebook($result); header("Refresh:0"); exit; } elseif ($result->publish_time - time() < 0 && $result->post_state == 5) { $state = '<h4>' . \Lang::get('check.pending') . '</h4><p>' . \Lang::get('check.pending_message') . '</p>'; $foot = ''; } else { $state = '<h4>' . \Lang::get('check.oops') . '</h4><p>' . \Lang::get('check.oops_message') . '<br />' . \Lang::get('check.try_contact_with') . '<a href="http://facebook.com/' . \Configer::get('page_id') . '">' . \Lang::get('check.page_admin') . '</a></p>'; $foot = ''; } return view('check', ['config' => \Configer::get(), 'state' => $state, 'foot' => $foot]); } } else { return redirect('/'); } } }
public function privilegeRecord() { if (\Auth::user()->admin == true) { $name = \Request::input('name'); if (\DB::select('select 1 from users where name = ? and admin = false and suspend = false', [$name])) { $date = new \DateTime(); $admin = \Auth::user()->name; $action = 'Give Admin Privilege'; \DB::update('update users set admin = true where name = ?', [$name]); \DB::insert('insert into log_privilege (p_name, p_admin, p_action, created_at, updated_at) values (?, ?, ?, ?, ?)', [$name, $admin, $action, $date, $date]); $messages = 'Success. User is now and admin.'; return redirect('/admin/privilege')->with('messages', $messages); } else { $messages = 'There is no such username or the user you meant is an admin which not eligible for this privilege or already have. Make sure of it.'; return redirect('/admin/privilege')->with('messages', $messages); } } else { $messages = 'You are not an admin. No rights to access administration area.'; return redirect('/system/notification')->with('messages', $messages); } }
function KisiGuncelle() { \DB::update('update users set name = ? where email = ?', [\Request::input('isim'), \Auth::user()->email]); \Auth::user()->name = \Request::input('isim'); return view('tekin', ['user' => $this->getUser()]); }