public function updateThreadPost($tid, $status, $page) { $Eveapi = new Eveapi(); $Eveapi->where('threadid', $tid)->update(array('update_status' => $status, "page" => $page)); return $tid; }
function bidNow(Request $request) { if (!Auth::check()) { return Redirect::to('/login'); } if ($request->isMethod('post')) { $rules = array('bid_am' => 'required|numeric', 'post_message' => 'required'); $id = Auth::user()->id; $characters = Character::join('character_profile', function ($j) { $j->on('characters.char_id', '=', 'character_profile.char_id'); //->where('bid_posts.post_rank',"=",1); })->where('characters.uid', "=", $id)->where('characters.status', '=', 1)->orderBy('characters.id', 'asc')->get()->take(1); foreach ($characters as $char) { $charname = $char['username']; $charid = $char['char_id']; } $post_message = trim($request->get('post_message')); $bid_am = trim($request->get('bid_am')); $bid_id = trim($request->get('bid_id')); $bid_post_detail = Evebid::where('bid_id', $bid_id)->orderBy('post_rank', 'desc')->take(1)->get(); foreach ($bid_post_detail as $dt) { $post_rank = $dt['post_rank']; } $bid_detail = Eveapi::where('id', $bid_id)->first(); if (!empty($bid_detail)) { $bid_detail->topicreplies = $bid_detail['topicreplies'] + 1; $bid_detail->save(); } $post_thread = new Evebid(); $post_thread->bid_id = $bid_id; $post_thread->char_id = $charid; $post_thread->post_rank = $post_rank + 1; $post_thread->post_time = Carbon::now(); $post_thread->update_time = Carbon::now(); $post_thread->wall_post = $post_message; $post_thread->profile_link = $charid . "_128.jpg"; $post_thread->username = $charname; $post_thread->bid_amount = $bid_am; $post_thread->save(); return Redirect::to('bazaar/' . $bid_id); } }