public function pbnliteProcess() { $s_date = date('Y-m-d' . " " . "00:00:00"); $e_date = date('Y-m-d' . " " . "23:59:59"); foreach (Input::get('post') as $lite) { $post = Post::find($lite); $pbnlite = PbnLite::where('created_at', '>=', $s_date)->where('created_at', '<=', $e_date)->count(); if ($pbnlite < 10) { $pbn_lite = new PbnLite(); $pbn_lite->title = $post->title; $pbn_lite->post_id = $lite; $pbn_lite->save(); } else { return Redirect::back()->with('flash_error', "Already 10 posts are selected"); } } return Redirect::back()->with('flash_success', "Successfull"); }