private function save($type, $data) { $dbcontent['user_id'] = Auth::user()->id; $dbcontent['activity_type'] = $type; $dbcontent['message_body'] = json_encode($data); $save = new Usersactivity(); $save->fill($dbcontent); $save->save(); }
public function stockUpdate() { Larasset::start('header')->css('daterangepicker'); Larasset::start('footer')->js('moment', 'daterangepicker'); $daterange = Input::get('record_range'); if (strpos($daterange, '-') !== FALSE) { $fromandto = explode('-', $daterange); $from = sqldate($fromandto[0]); $to_plus_1day = strtotime('now') - strtotime('yesterday') + strtotime($fromandto[1]); $to = sqldate(date('Y/n/d', $to_plus_1day)); $data['todate'] = $fromandto[1]; } else { $from = sqldate(date('Y/n/d', strtotime('first day of this month'))); $to = sqldate('+1day'); $data['todate'] = $to; } $data['fromdate'] = $from; $data['todate'] = $to; $time = array($data['fromdate'], $data['todate']); $activities = Usersactivity::where('activity_type', '=', 'stock')->whereBetween('created_at', $time)->orderBy('id', 'desc')->get(); //$data = array(); if ($activities != null) { $data['activities'] = $activities; } $this->layout->title = "Welcome to Admin Area"; $this->layout->content = View::make('admin.stockupdate_record.index', $data); }
private function stockupdate($date = 'stockupdate_today') { $time = $this->_dateSetter($date); $activities = Usersactivity::where('activity_type', '=', 'stock')->whereBetween('created_at', $time)->orderBy('id', 'desc')->get(); $data = array(); if ($activities != null) { $data['activities'] = $activities; } return $data; }
public function adminPreviewStaffProfile($staffID) { Larasset::start('footer')->js('bootstrap_editable', 'bootstrap-datepicker'); Larasset::start('header')->css('bootstrap_editable', 'bootstrap-datepicker'); //Lets the details of a staff $staff = User::find($staffID); //Lets get the staff's Activity $activity = Usersactivity::where('user_id', '=', $staffID)->take(10)->orderBy('id', 'desc')->get(); //tt($activity->toArray()); //Lets get how much the staff's ever sold $salesworth = User::find($staffID)->salelogs()->sum('total_unitprice'); $data['salesworth'] = 0.0; $data['role'] = Role::all()->lists('id', 'name'); //tt($data['role']); if (!empty($salesworth) && $salesworth !== null) { $data['salesworth'] = $salesworth; } $data['staff'] = $staff->toArray(); $data['activities'] = $activity; return View::make('admin.previewstaffprofile', $data); }