public function create_admin() { $validate = AnnouncementComments::validate(Input::all()); if ($validate->passes()) { $model = new AnnouncementComments(); $model->post_id = Input::get('postid'); $model->employee_id = Auth::user()->employee_id; $model->post_comment = Input::get('comment'); $model->save(); return Redirect::route('viewpost', Input::get('postid')); } else { return Redirect::route('viewpost', Input::get('postid'))->withErrors($validate); } }
public function show_announce($id) { $post_comment = AnnouncementComments::where('post_id', $id)->orderBy('created_at', 'desc')->get(); $leavecount = LeaveCounter::where('employee_id', Auth::user()->employee_id)->first(); $announce = Announcements::with('user')->where('post_id', $id)->orderBy('created_at', 'desc')->first(); $profile = UserDetails::where('employee_id', '=', Auth::user()->employee_id)->first(); $recentleave = LeaveWPay::with('user')->where('employee_id', Auth::user()->employee_id)->orderBy('created_at', 'desc')->get(); $recentwleave = LeaveWOPay::with('user')->where('employee_id', Auth::user()->employee_id)->orderBy('created_at', 'desc')->get(); return View::make('dashboard.announcement')->with('post', $announce)->with('post_comment', $post_comment)->with('profile', $profile)->with('countleave', $leavecount)->with('rleave', $recentleave)->with('sleave', $recentwleave)->with('title', 'STI | Show Announcement'); }
public function post_delete($id) { $d_login = UserLogin::where('employee_id', $id)->first(); $d_login->delete(); $userlog = UserLeaveLog::where('employee_id', $id)->delete(); LeaveWPay::where('employee_id', $id)->delete(); LeaveWOPay::where('employee_id', $id)->delete(); LeaveCounter::where('employee_id', $id)->delete(); LeaveAWT::where('employee_id', $id)->delete(); LeaveOB::where('employee_id', $id)->delete(); AdminLogWP::where('employee_id', $id)->delete(); AdminLogWOP::where('employee_id', $id)->delete(); AdminLogOB::where('employee_id', $id)->delete(); AdminLogAWT::where('employee_id', $id)->delete(); AnnouncementComments::where('employee_id', $id)->delete(); Approval::where('employee_id', $id)->delete(); $d_user = UserDetails::where('employee_id', $id)->first(); $d_user->delete(); return Redirect::route('view_users'); }