Beispiel #1
0
 /**
  * @before _secure
  */
 public function bills()
 {
     $this->seo(array("title" => "Bills"));
     $view = $this->getActionView();
     $start = RM::get("start", date("Y-m-d", strtotime('-7 day')));
     $end = RM::get("end", date("Y-m-d", strtotime('now')));
     $query = ['user_id = ?' => $this->user->_id, 'created = ?' => Db::dateQuery($start, $end)];
     $performances = \Performance::all($query, [], 'created', 'desc');
     $invoices = \Invoice::all(['user_id = ?' => $this->user->_id]);
     $view->set("performances", $performances)->set("invoices", $invoices);
     $view->set("start", $start);
     $view->set("end", $end);
 }
Beispiel #2
0
 private function _reportspub($query, $start, $end, $limit, $page)
 {
     $view = $this->getActionView();
     $dateQuery = Utils::dateQuery(['start' => $start, 'end' => $end]);
     $links = \Link::all($query, [], 'created', 'desc', $limit, $page);
     $count = \Link::count($query);
     $query["created"] = Db::dateQuery($start, $end);
     $performances = \Performance::all($query, ['created', 'clicks', 'revenue'], 'created', 'desc');
     $in = [];
     foreach ($links as $l) {
         // only find clicks for the ads whose links are created
         $in[] = Utils::mongoObjectId($l->ad_id);
     }
     // find clicks
     $clickCol = Registry::get("MongoDB")->clicks;
     $records = Db::query('Click', ['adid' => ['$in' => $in], 'is_bot' => false, 'pid' => $query['user_id'], 'created' => $query['created']], ['adid', 'country']);
     $view->set(['limit' => $limit, 'page' => $page, 'count' => $count, 'start' => $start, 'end' => $end, 'links' => $links, 'performances' => $performances, 'clicks' => Click::classify($records, 'adid'), 'commission' => $this->user->commission(), 'dq' => $query['created']]);
 }
Beispiel #3
0
 /**
  * @before _secure
  */
 public function raiseinvoice()
 {
     $this->seo(array("title" => "Create Invoice"));
     $view = $this->getActionView();
     $perfs = [];
     $start = RM::get("start");
     $end = RM::get("end");
     $user_id = RM::get("user_id", null);
     $view->set('user_id', $user_id)->set('start', $start)->set('end', $end);
     $dateQuery = Utils::dateQuery($start, $end);
     $query['created'] = ['$gte' => $dateQuery['start'], '$lte' => $dateQuery['end']];
     $query['user_id'] = $user_id;
     if ($user_id) {
         $user = \User::first(['type = ?' => 'advertiser', 'org_id = ?' => $this->org->_id, 'id = ?' => $user_id]);
         $view->set('advertiser', $user);
         $performances = Performance::all($query, ['clicks', 'impressions', 'conversions', 'created', 'revenue'], 'created', 'desc');
         foreach ($performances as $p) {
             $perfs[] = $p;
         }
         $view->set('performances', $perfs);
         $inv_exist = Invoice::exists($user_id, $start, $end);
         if ($inv_exist) {
             $view->set("message", "Invoice already exist for Date range from " . Framework\StringMethods::only_date($inv_exist->start) . " to " . Framework\StringMethods::only_date($inv_exist->end));
             return;
         }
     } else {
         $advertisers = \User::all(['type = ?' => 'advertiser', 'org_id' => $this->org->_id], ['id', 'name']);
         $view->set('advertisers', $advertisers);
     }
     if (RM::post("action") == "cinvoice" && RM::post("amount") > 0) {
         $invoice = new Invoice(["org_id" => $this->org->id, "user_id" => $user->id, "utype" => $user->type, "start" => end($perfs)->created, "end" => $perfs[0]->created, "amount" => RM::post("amount"), "live" => false]);
         $invoice->save();
         Registry::get("session")->set('$flashMessage', 'Payment Saved!!');
         $this->redirect("/billing/advertisers.html");
     }
 }
 public function run()
 {
     $faker = Faker\Factory::create();
     //=================================== For single user and no loop==================//
     /*			Performance::create([
     				'user_id'	=> 2,
     				'dept_id'=> 1,
     				'util1'	 	=> $faker->numberBetween($min = 1, $max = 5),
     				'util2'	 	=> $faker->numberBetween($min = 1, $max = 5),
     				'util3'	 	=> $faker->numberBetween($min = 1, $max = 5),
     				'qow1'	 	=> $faker->numberBetween($min = 1, $max = 5),
     				'qow2'		=> $faker->numberBetween($min = 1, $max = 5),
     				'qow3'		=> $faker->numberBetween($min = 1, $max = 5),
     				'qow4'      => $faker->numberBetween($min = 1, $max = 5),
     				'qow5'		=> $faker->numberBetween($min = 1, $max = 5),
     				'qow6'		=> $faker->numberBetween($min = 1, $max = 5),
     				'qow7'		=> $faker->numberBetween($min = 1, $max = 5),
     				'qow8'		=> $faker->numberBetween($min = 1, $max = 5),
     				'pffp1'		=> $faker->numberBetween($min = 1, $max = 5),
     				'pffp2'		=> $faker->numberBetween($min = 1, $max = 5),
     				'pffp3'		=> $faker->numberBetween($min = 1, $max = 5),
     				'pffp4'		=> $faker->numberBetween($min = 1, $max = 5),
     				'pffp5'		=> $faker->numberBetween($min = 1, $max = 5),
     				'pffp6'		=> $faker->numberBetween($min = 1, $max = 5),
     				'pffp7'		=> $faker->numberBetween($min = 1, $max = 5),
     				'pffp8'		=> $faker->numberBetween($min = 1, $max = 5),
     				'pffp9'		=> $faker->numberBetween($min = 1, $max = 5),
     				'pffp10'	=> $faker->numberBetween($min = 1, $max = 5),
     				'pffp11'	=> $faker->numberBetween($min = 1, $max = 5),
     				'comments'	=> $faker->text(100),
     				'status'	=>	'Finalized',
     				'semester'	=>	'2nd',
     				'year'		=>	'2015'
     
     
     
     			]);
     
     
     			Performance::create([
     				'user_id'	=> 2,
     				'dept_id'	=> 1,
     				'util1'	 	=> $faker->numberBetween($min = 1, $max = 5),
     				'util2'	 	=> $faker->numberBetween($min = 1, $max = 5),
     				'util3'	 	=> $faker->numberBetween($min = 1, $max = 5),
     				'qow1'	 	=> $faker->numberBetween($min = 1, $max = 5),
     				'qow2'		=> $faker->numberBetween($min = 1, $max = 5),
     				'qow3'		=> $faker->numberBetween($min = 1, $max = 5),
     				'qow4'      => $faker->numberBetween($min = 1, $max = 5),
     				'qow5'		=> $faker->numberBetween($min = 1, $max = 5),
     				'qow6'		=> $faker->numberBetween($min = 1, $max = 5),
     				'qow7'		=> $faker->numberBetween($min = 1, $max = 5),
     				'qow8'		=> $faker->numberBetween($min = 1, $max = 5),
     				'pffp1'		=> $faker->numberBetween($min = 1, $max = 5),
     				'pffp2'		=> $faker->numberBetween($min = 1, $max = 5),
     				'pffp3'		=> $faker->numberBetween($min = 1, $max = 5),
     				'pffp4'		=> $faker->numberBetween($min = 1, $max = 5),
     				'pffp5'		=> $faker->numberBetween($min = 1, $max = 5),
     				'pffp6'		=> $faker->numberBetween($min = 1, $max = 5),
     				'pffp7'		=> $faker->numberBetween($min = 1, $max = 5),
     				'pffp8'		=> $faker->numberBetween($min = 1, $max = 5),
     				'pffp9'		=> $faker->numberBetween($min = 1, $max = 5),
     				'pffp10'	=> $faker->numberBetween($min = 1, $max = 5),
     				'pffp11'	=> $faker->numberBetween($min = 1, $max = 5),
     				'comments'	=> $faker->text(100),
     				'status'	=>	'Finalized',
     				'semester'	=>	'1st',
     				'year'		=>	'2015'
     
     
     
     			]);
     
     
     			Performance::create([
     				'user_id'	=> 4,
     				'dept_id'	=> 2,
     				'util1'	 	=> $faker->numberBetween($min = 1, $max = 5),
     				'util2'	 	=> $faker->numberBetween($min = 1, $max = 5),
     				'util3'	 	=> $faker->numberBetween($min = 1, $max = 5),
     				'qow1'	 	=> $faker->numberBetween($min = 1, $max = 5),
     				'qow2'		=> $faker->numberBetween($min = 1, $max = 5),
     				'qow3'		=> $faker->numberBetween($min = 1, $max = 5),
     				'qow4'      => $faker->numberBetween($min = 1, $max = 5),
     				'qow5'		=> $faker->numberBetween($min = 1, $max = 5),
     				'qow6'		=> $faker->numberBetween($min = 1, $max = 5),
     				'qow7'		=> $faker->numberBetween($min = 1, $max = 5),
     				'qow8'		=> $faker->numberBetween($min = 1, $max = 5),
     				'pffp1'		=> $faker->numberBetween($min = 1, $max = 5),
     				'pffp2'		=> $faker->numberBetween($min = 1, $max = 5),
     				'pffp3'		=> $faker->numberBetween($min = 1, $max = 5),
     				'pffp4'		=> $faker->numberBetween($min = 1, $max = 5),
     				'pffp5'		=> $faker->numberBetween($min = 1, $max = 5),
     				'pffp6'		=> $faker->numberBetween($min = 1, $max = 5),
     				'pffp7'		=> $faker->numberBetween($min = 1, $max = 5),
     				'pffp8'		=> $faker->numberBetween($min = 1, $max = 5),
     				'pffp9'		=> $faker->numberBetween($min = 1, $max = 5),
     				'pffp10'	=> $faker->numberBetween($min = 1, $max = 5),
     				'pffp11'	=> $faker->numberBetween($min = 1, $max = 5),
     				'comments'	=> $faker->text(100),
     				'status'	=>	'Finalized',
     				'semester'	=>	'2nd',
     				'year'		=>	'2015'
     
     
     
     			]);
     
     
     			Performance::create([
     				'user_id'	=> 4,
     				'dept_id'	=> 2,
     				'util1'	 	=> $faker->numberBetween($min = 1, $max = 5),
     				'util2'	 	=> $faker->numberBetween($min = 1, $max = 5),
     				'util3'	 	=> $faker->numberBetween($min = 1, $max = 5),
     				'qow1'	 	=> $faker->numberBetween($min = 1, $max = 5),
     				'qow2'		=> $faker->numberBetween($min = 1, $max = 5),
     				'qow3'		=> $faker->numberBetween($min = 1, $max = 5),
     				'qow4'      => $faker->numberBetween($min = 1, $max = 5),
     				'qow5'		=> $faker->numberBetween($min = 1, $max = 5),
     				'qow6'		=> $faker->numberBetween($min = 1, $max = 5),
     				'qow7'		=> $faker->numberBetween($min = 1, $max = 5),
     				'qow8'		=> $faker->numberBetween($min = 1, $max = 5),
     				'pffp1'		=> $faker->numberBetween($min = 1, $max = 5),
     				'pffp2'		=> $faker->numberBetween($min = 1, $max = 5),
     				'pffp3'		=> $faker->numberBetween($min = 1, $max = 5),
     				'pffp4'		=> $faker->numberBetween($min = 1, $max = 5),
     				'pffp5'		=> $faker->numberBetween($min = 1, $max = 5),
     				'pffp6'		=> $faker->numberBetween($min = 1, $max = 5),
     				'pffp7'		=> $faker->numberBetween($min = 1, $max = 5),
     				'pffp8'		=> $faker->numberBetween($min = 1, $max = 5),
     				'pffp9'		=> $faker->numberBetween($min = 1, $max = 5),
     				'pffp10'	=> $faker->numberBetween($min = 1, $max = 5),
     				'pffp11'	=> $faker->numberBetween($min = 1, $max = 5),
     				'comments'	=> $faker->text(100),
     				'status'	=>	'Finalized',
     				'semester'	=>	'1st',
     				'year'		=>	'2015'
     
     
     
     			]);
     */
     //================================================================================================//
     for ($id = 2; $id < 5; $id++) {
         $user = User::find($id);
         Performance::create(['user_id' => $id, 'dept_id' => $user->department_id, 'util1' => $faker->numberBetween($min = 4, $max = 6), 'util2' => $faker->numberBetween($min = 4, $max = 6), 'util3' => $faker->numberBetween($min = 4, $max = 6), 'qow1' => $faker->numberBetween($min = 4, $max = 6), 'qow2' => $faker->numberBetween($min = 4, $max = 6), 'qow3' => $faker->numberBetween($min = 4, $max = 6), 'qow4' => $faker->numberBetween($min = 4, $max = 6), 'qow5' => $faker->numberBetween($min = 4, $max = 6), 'qow6' => $faker->numberBetween($min = 4, $max = 6), 'qow7' => $faker->numberBetween($min = 4, $max = 6), 'qow8' => $faker->numberBetween($min = 4, $max = 6), 'pffp1' => $faker->numberBetween($min = 4, $max = 6), 'pffp2' => $faker->numberBetween($min = 4, $max = 6), 'pffp3' => $faker->numberBetween($min = 4, $max = 6), 'pffp4' => $faker->numberBetween($min = 4, $max = 6), 'pffp5' => $faker->numberBetween($min = 4, $max = 6), 'pffp6' => $faker->numberBetween($min = 4, $max = 6), 'pffp7' => $faker->numberBetween($min = 4, $max = 6), 'pffp8' => $faker->numberBetween($min = 4, $max = 6), 'pffp9' => $faker->numberBetween($min = 4, $max = 6), 'pffp10' => $faker->numberBetween($min = 4, $max = 6), 'pffp11' => $faker->numberBetween($min = 4, $max = 6), 'comments' => $faker->text(100), 'status' => 'Finalized', 'semester' => '1st', 'year' => '2015']);
     }
     for ($id = 2; $id < 5; $id++) {
         $user = User::find($id);
         Performance::create(['user_id' => $id, 'dept_id' => $user->department_id, 'util1' => $faker->numberBetween($min = 5, $max = 6), 'util2' => $faker->numberBetween($min = 5, $max = 6), 'util3' => $faker->numberBetween($min = 5, $max = 6), 'qow1' => $faker->numberBetween($min = 5, $max = 6), 'qow2' => $faker->numberBetween($min = 5, $max = 6), 'qow3' => $faker->numberBetween($min = 5, $max = 6), 'qow4' => $faker->numberBetween($min = 5, $max = 6), 'qow5' => $faker->numberBetween($min = 5, $max = 6), 'qow6' => $faker->numberBetween($min = 5, $max = 6), 'qow7' => $faker->numberBetween($min = 5, $max = 6), 'qow8' => $faker->numberBetween($min = 5, $max = 6), 'pffp1' => $faker->numberBetween($min = 5, $max = 6), 'pffp2' => $faker->numberBetween($min = 5, $max = 6), 'pffp3' => $faker->numberBetween($min = 5, $max = 6), 'pffp4' => $faker->numberBetween($min = 5, $max = 6), 'pffp5' => $faker->numberBetween($min = 5, $max = 6), 'pffp6' => $faker->numberBetween($min = 5, $max = 6), 'pffp7' => $faker->numberBetween($min = 5, $max = 6), 'pffp8' => $faker->numberBetween($min = 5, $max = 6), 'pffp9' => $faker->numberBetween($min = 5, $max = 6), 'pffp10' => $faker->numberBetween($min = 5, $max = 6), 'pffp11' => $faker->numberBetween($min = 5, $max = 6), 'comments' => $faker->text(100), 'status' => 'Finalized', 'semester' => '2nd', 'year' => '2015']);
     }
     for ($id = 2; $id < 5; $id++) {
         $user = User::find($id);
         Performance::create(['user_id' => $id, 'dept_id' => $user->department_id, 'util1' => $faker->numberBetween($min = 5, $max = 6), 'util2' => $faker->numberBetween($min = 5, $max = 6), 'util3' => $faker->numberBetween($min = 5, $max = 6), 'qow1' => $faker->numberBetween($min = 5, $max = 6), 'qow2' => $faker->numberBetween($min = 5, $max = 6), 'qow3' => $faker->numberBetween($min = 5, $max = 6), 'qow4' => $faker->numberBetween($min = 5, $max = 6), 'qow5' => $faker->numberBetween($min = 5, $max = 6), 'qow6' => $faker->numberBetween($min = 5, $max = 6), 'qow7' => $faker->numberBetween($min = 5, $max = 6), 'qow8' => $faker->numberBetween($min = 5, $max = 6), 'pffp1' => $faker->numberBetween($min = 5, $max = 6), 'pffp2' => $faker->numberBetween($min = 5, $max = 6), 'pffp3' => $faker->numberBetween($min = 5, $max = 6), 'pffp4' => $faker->numberBetween($min = 5, $max = 6), 'pffp5' => $faker->numberBetween($min = 5, $max = 6), 'pffp6' => $faker->numberBetween($min = 5, $max = 6), 'pffp7' => $faker->numberBetween($min = 5, $max = 6), 'pffp8' => $faker->numberBetween($min = 5, $max = 6), 'pffp9' => $faker->numberBetween($min = 5, $max = 6), 'pffp10' => $faker->numberBetween($min = 5, $max = 6), 'pffp11' => $faker->numberBetween($min = 5, $max = 6), 'comments' => $faker->text(100), 'status' => 'Finalized', 'semester' => '1st', 'year' => '2015']);
     }
     for ($id = 2; $id < 5; $id++) {
         $user = User::find($id);
         Performance::create(['user_id' => $id, 'dept_id' => $user->department_id, 'util1' => $faker->numberBetween($min = 5, $max = 6), 'util2' => $faker->numberBetween($min = 5, $max = 6), 'util3' => $faker->numberBetween($min = 5, $max = 6), 'qow1' => $faker->numberBetween($min = 5, $max = 6), 'qow2' => $faker->numberBetween($min = 5, $max = 6), 'qow3' => $faker->numberBetween($min = 5, $max = 6), 'qow4' => $faker->numberBetween($min = 5, $max = 6), 'qow5' => $faker->numberBetween($min = 5, $max = 6), 'qow6' => $faker->numberBetween($min = 5, $max = 6), 'qow7' => $faker->numberBetween($min = 5, $max = 6), 'qow8' => $faker->numberBetween($min = 5, $max = 6), 'pffp1' => $faker->numberBetween($min = 5, $max = 6), 'pffp2' => $faker->numberBetween($min = 5, $max = 6), 'pffp3' => $faker->numberBetween($min = 5, $max = 6), 'pffp4' => $faker->numberBetween($min = 5, $max = 6), 'pffp5' => $faker->numberBetween($min = 5, $max = 6), 'pffp6' => $faker->numberBetween($min = 5, $max = 6), 'pffp7' => $faker->numberBetween($min = 5, $max = 6), 'pffp8' => $faker->numberBetween($min = 5, $max = 6), 'pffp9' => $faker->numberBetween($min = 5, $max = 6), 'pffp10' => $faker->numberBetween($min = 5, $max = 6), 'pffp11' => $faker->numberBetween($min = 5, $max = 6), 'comments' => $faker->text(100), 'status' => 'Finalized', 'semester' => '2nd', 'year' => '2015']);
     }
     for ($id = 5; $id < 19; $id++) {
         $user = User::find($id);
         Performance::create(['user_id' => $id, 'dept_id' => $user->department_id, 'util1' => $faker->numberBetween($min = 1, $max = 6), 'util2' => $faker->numberBetween($min = 1, $max = 6), 'util3' => $faker->numberBetween($min = 1, $max = 6), 'qow1' => $faker->numberBetween($min = 1, $max = 6), 'qow2' => $faker->numberBetween($min = 1, $max = 6), 'qow3' => $faker->numberBetween($min = 1, $max = 4), 'qow4' => $faker->numberBetween($min = 1, $max = 4), 'qow5' => $faker->numberBetween($min = 1, $max = 4), 'qow6' => $faker->numberBetween($min = 1, $max = 4), 'qow7' => $faker->numberBetween($min = 1, $max = 4), 'qow8' => $faker->numberBetween($min = 1, $max = 2), 'pffp1' => $faker->numberBetween($min = 1, $max = 2), 'pffp2' => $faker->numberBetween($min = 1, $max = 2), 'pffp3' => $faker->numberBetween($min = 1, $max = 2), 'pffp4' => $faker->numberBetween($min = 1, $max = 2), 'pffp5' => $faker->numberBetween($min = 1, $max = 3), 'pffp6' => $faker->numberBetween($min = 1, $max = 3), 'pffp7' => $faker->numberBetween($min = 1, $max = 3), 'pffp8' => $faker->numberBetween($min = 1, $max = 3), 'pffp9' => $faker->numberBetween($min = 1, $max = 3), 'pffp10' => $faker->numberBetween($min = 1, $max = 4), 'pffp11' => $faker->numberBetween($min = 1, $max = 4), 'comments' => $faker->text(100), 'status' => 'Finalized', 'semester' => '1st', 'year' => '2015']);
     }
     for ($id = 5; $id < 19; $id++) {
         $user = User::find($id);
         Performance::create(['user_id' => $id, 'dept_id' => $user->department_id, 'util1' => $faker->numberBetween($min = 1, $max = 6), 'util2' => $faker->numberBetween($min = 1, $max = 6), 'util3' => $faker->numberBetween($min = 1, $max = 6), 'qow1' => $faker->numberBetween($min = 1, $max = 6), 'qow2' => $faker->numberBetween($min = 1, $max = 6), 'qow3' => $faker->numberBetween($min = 1, $max = 6), 'qow4' => $faker->numberBetween($min = 1, $max = 6), 'qow5' => $faker->numberBetween($min = 1, $max = 6), 'qow6' => $faker->numberBetween($min = 1, $max = 6), 'qow7' => $faker->numberBetween($min = 1, $max = 6), 'qow8' => $faker->numberBetween($min = 1, $max = 6), 'pffp1' => $faker->numberBetween($min = 1, $max = 6), 'pffp2' => $faker->numberBetween($min = 1, $max = 6), 'pffp3' => $faker->numberBetween($min = 1, $max = 6), 'pffp4' => $faker->numberBetween($min = 1, $max = 6), 'pffp5' => $faker->numberBetween($min = 1, $max = 6), 'pffp6' => $faker->numberBetween($min = 1, $max = 6), 'pffp7' => $faker->numberBetween($min = 1, $max = 6), 'pffp8' => $faker->numberBetween($min = 1, $max = 6), 'pffp9' => $faker->numberBetween($min = 1, $max = 6), 'pffp10' => $faker->numberBetween($min = 1, $max = 6), 'pffp11' => $faker->numberBetween($min = 1, $max = 6), 'comments' => $faker->text(100), 'status' => 'Finalized', 'semester' => '2nd', 'year' => '2015']);
     }
     for ($id = 2; $id < 5; $id++) {
         $user = User::find($id);
         Performance::create(['user_id' => $id, 'dept_id' => $user->department_id, 'util1' => $faker->numberBetween($min = 5, $max = 6), 'util2' => $faker->numberBetween($min = 5, $max = 6), 'util3' => $faker->numberBetween($min = 5, $max = 6), 'qow1' => $faker->numberBetween($min = 5, $max = 6), 'qow2' => $faker->numberBetween($min = 5, $max = 6), 'qow3' => $faker->numberBetween($min = 5, $max = 6), 'qow4' => $faker->numberBetween($min = 5, $max = 6), 'qow5' => $faker->numberBetween($min = 5, $max = 6), 'qow6' => $faker->numberBetween($min = 5, $max = 6), 'qow7' => $faker->numberBetween($min = 5, $max = 6), 'qow8' => $faker->numberBetween($min = 5, $max = 6), 'pffp1' => $faker->numberBetween($min = 5, $max = 6), 'pffp2' => $faker->numberBetween($min = 5, $max = 6), 'pffp3' => $faker->numberBetween($min = 5, $max = 6), 'pffp4' => $faker->numberBetween($min = 5, $max = 6), 'pffp5' => $faker->numberBetween($min = 5, $max = 6), 'pffp6' => $faker->numberBetween($min = 5, $max = 6), 'pffp7' => $faker->numberBetween($min = 5, $max = 6), 'pffp8' => $faker->numberBetween($min = 5, $max = 6), 'pffp9' => $faker->numberBetween($min = 5, $max = 6), 'pffp10' => $faker->numberBetween($min = 5, $max = 6), 'pffp11' => $faker->numberBetween($min = 5, $max = 6), 'comments' => $faker->text(100), 'status' => 'Finalized', 'semester' => '1st', 'year' => '2014']);
     }
     for ($id = 2; $id < 5; $id++) {
         $user = User::find($id);
         Performance::create(['user_id' => $id, 'dept_id' => $user->department_id, 'util1' => $faker->numberBetween($min = 5, $max = 6), 'util2' => $faker->numberBetween($min = 5, $max = 6), 'util3' => $faker->numberBetween($min = 5, $max = 6), 'qow1' => $faker->numberBetween($min = 5, $max = 6), 'qow2' => $faker->numberBetween($min = 5, $max = 6), 'qow3' => $faker->numberBetween($min = 5, $max = 6), 'qow4' => $faker->numberBetween($min = 5, $max = 6), 'qow5' => $faker->numberBetween($min = 5, $max = 6), 'qow6' => $faker->numberBetween($min = 5, $max = 6), 'qow7' => $faker->numberBetween($min = 5, $max = 6), 'qow8' => $faker->numberBetween($min = 5, $max = 6), 'pffp1' => $faker->numberBetween($min = 5, $max = 6), 'pffp2' => $faker->numberBetween($min = 5, $max = 6), 'pffp3' => $faker->numberBetween($min = 5, $max = 6), 'pffp4' => $faker->numberBetween($min = 5, $max = 6), 'pffp5' => $faker->numberBetween($min = 5, $max = 6), 'pffp6' => $faker->numberBetween($min = 5, $max = 6), 'pffp7' => $faker->numberBetween($min = 5, $max = 6), 'pffp8' => $faker->numberBetween($min = 5, $max = 6), 'pffp9' => $faker->numberBetween($min = 5, $max = 6), 'pffp10' => $faker->numberBetween($min = 5, $max = 6), 'pffp11' => $faker->numberBetween($min = 5, $max = 6), 'comments' => $faker->text(100), 'status' => 'Finalized', 'semester' => '2nd', 'year' => '2014']);
     }
     for ($id = 5; $id < 19; $id++) {
         $user = User::find($id);
         Performance::create(['user_id' => $id, 'dept_id' => $user->department_id, 'util1' => $faker->numberBetween($min = 1, $max = 6), 'util2' => $faker->numberBetween($min = 1, $max = 6), 'util3' => $faker->numberBetween($min = 1, $max = 6), 'qow1' => $faker->numberBetween($min = 1, $max = 6), 'qow2' => $faker->numberBetween($min = 1, $max = 6), 'qow3' => $faker->numberBetween($min = 1, $max = 4), 'qow4' => $faker->numberBetween($min = 1, $max = 4), 'qow5' => $faker->numberBetween($min = 1, $max = 4), 'qow6' => $faker->numberBetween($min = 1, $max = 4), 'qow7' => $faker->numberBetween($min = 1, $max = 4), 'qow8' => $faker->numberBetween($min = 1, $max = 2), 'pffp1' => $faker->numberBetween($min = 1, $max = 2), 'pffp2' => $faker->numberBetween($min = 1, $max = 2), 'pffp3' => $faker->numberBetween($min = 1, $max = 2), 'pffp4' => $faker->numberBetween($min = 1, $max = 2), 'pffp5' => $faker->numberBetween($min = 1, $max = 3), 'pffp6' => $faker->numberBetween($min = 1, $max = 3), 'pffp7' => $faker->numberBetween($min = 1, $max = 3), 'pffp8' => $faker->numberBetween($min = 1, $max = 3), 'pffp9' => $faker->numberBetween($min = 1, $max = 3), 'pffp10' => $faker->numberBetween($min = 1, $max = 4), 'pffp11' => $faker->numberBetween($min = 1, $max = 4), 'comments' => $faker->text(100), 'status' => 'Finalized', 'semester' => '1st', 'year' => '2014']);
     }
     for ($id = 5; $id < 19; $id++) {
         $user = User::find($id);
         Performance::create(['user_id' => $id, 'dept_id' => $user->department_id, 'util1' => $faker->numberBetween($min = 1, $max = 6), 'util2' => $faker->numberBetween($min = 1, $max = 6), 'util3' => $faker->numberBetween($min = 1, $max = 6), 'qow1' => $faker->numberBetween($min = 1, $max = 6), 'qow2' => $faker->numberBetween($min = 1, $max = 6), 'qow3' => $faker->numberBetween($min = 1, $max = 4), 'qow4' => $faker->numberBetween($min = 1, $max = 4), 'qow5' => $faker->numberBetween($min = 1, $max = 4), 'qow6' => $faker->numberBetween($min = 1, $max = 4), 'qow7' => $faker->numberBetween($min = 1, $max = 4), 'qow8' => $faker->numberBetween($min = 1, $max = 2), 'pffp1' => $faker->numberBetween($min = 1, $max = 2), 'pffp2' => $faker->numberBetween($min = 1, $max = 2), 'pffp3' => $faker->numberBetween($min = 1, $max = 2), 'pffp4' => $faker->numberBetween($min = 1, $max = 2), 'pffp5' => $faker->numberBetween($min = 1, $max = 3), 'pffp6' => $faker->numberBetween($min = 1, $max = 3), 'pffp7' => $faker->numberBetween($min = 1, $max = 3), 'pffp8' => $faker->numberBetween($min = 1, $max = 3), 'pffp9' => $faker->numberBetween($min = 1, $max = 3), 'pffp10' => $faker->numberBetween($min = 1, $max = 4), 'pffp11' => $faker->numberBetween($min = 1, $max = 4), 'comments' => $faker->text(100), 'status' => 'Finalized', 'semester' => '2nd', 'year' => '2014']);
     }
     for ($id = 5; $id < 19; $id++) {
         $user = User::find($id);
         Performance::create(['user_id' => $id, 'dept_id' => $user->department_id, 'util1' => $faker->numberBetween($min = 1, $max = 6), 'util2' => $faker->numberBetween($min = 1, $max = 6), 'util3' => $faker->numberBetween($min = 1, $max = 6), 'qow1' => $faker->numberBetween($min = 1, $max = 6), 'qow2' => $faker->numberBetween($min = 1, $max = 6), 'qow3' => $faker->numberBetween($min = 1, $max = 4), 'qow4' => $faker->numberBetween($min = 1, $max = 4), 'qow5' => $faker->numberBetween($min = 1, $max = 4), 'qow6' => $faker->numberBetween($min = 1, $max = 4), 'qow7' => $faker->numberBetween($min = 1, $max = 4), 'qow8' => $faker->numberBetween($min = 1, $max = 2), 'pffp1' => $faker->numberBetween($min = 1, $max = 2), 'pffp2' => $faker->numberBetween($min = 1, $max = 2), 'pffp3' => $faker->numberBetween($min = 1, $max = 2), 'pffp4' => $faker->numberBetween($min = 1, $max = 2), 'pffp5' => $faker->numberBetween($min = 1, $max = 3), 'pffp6' => $faker->numberBetween($min = 1, $max = 3), 'pffp7' => $faker->numberBetween($min = 1, $max = 3), 'pffp8' => $faker->numberBetween($min = 1, $max = 3), 'pffp9' => $faker->numberBetween($min = 1, $max = 3), 'pffp10' => $faker->numberBetween($min = 1, $max = 4), 'pffp11' => $faker->numberBetween($min = 1, $max = 4), 'comments' => $faker->text(100), 'status' => 'Finalized', 'semester' => '1st', 'year' => '2016']);
     }
     for ($id = 5; $id < 19; $id++) {
         $user = User::find($id);
         Performance::create(['user_id' => $id, 'dept_id' => $user->department_id, 'util1' => $faker->numberBetween($min = 1, $max = 6), 'util2' => $faker->numberBetween($min = 1, $max = 6), 'util3' => $faker->numberBetween($min = 1, $max = 6), 'qow1' => $faker->numberBetween($min = 1, $max = 6), 'qow2' => $faker->numberBetween($min = 1, $max = 6), 'qow3' => $faker->numberBetween($min = 1, $max = 4), 'qow4' => $faker->numberBetween($min = 1, $max = 4), 'qow5' => $faker->numberBetween($min = 1, $max = 4), 'qow6' => $faker->numberBetween($min = 1, $max = 4), 'qow7' => $faker->numberBetween($min = 1, $max = 4), 'qow8' => $faker->numberBetween($min = 1, $max = 2), 'pffp1' => $faker->numberBetween($min = 1, $max = 2), 'pffp2' => $faker->numberBetween($min = 1, $max = 2), 'pffp3' => $faker->numberBetween($min = 1, $max = 2), 'pffp4' => $faker->numberBetween($min = 1, $max = 2), 'pffp5' => $faker->numberBetween($min = 1, $max = 3), 'pffp6' => $faker->numberBetween($min = 1, $max = 3), 'pffp7' => $faker->numberBetween($min = 1, $max = 3), 'pffp8' => $faker->numberBetween($min = 1, $max = 3), 'pffp9' => $faker->numberBetween($min = 1, $max = 3), 'pffp10' => $faker->numberBetween($min = 1, $max = 4), 'pffp11' => $faker->numberBetween($min = 1, $max = 4), 'comments' => $faker->text(100), 'status' => 'Finalized', 'semester' => '2nd', 'year' => '2016']);
     }
     for ($id = 2; $id < 5; $id++) {
         $user = User::find($id);
         Performance::create(['user_id' => $id, 'dept_id' => $user->department_id, 'util1' => $faker->numberBetween($min = 6, $max = 6), 'util2' => $faker->numberBetween($min = 6, $max = 6), 'util3' => $faker->numberBetween($min = 5, $max = 6), 'qow1' => $faker->numberBetween($min = 5, $max = 6), 'qow2' => $faker->numberBetween($min = 6, $max = 6), 'qow3' => $faker->numberBetween($min = 6, $max = 6), 'qow4' => $faker->numberBetween($min = 6, $max = 6), 'qow5' => $faker->numberBetween($min = 5, $max = 6), 'qow6' => $faker->numberBetween($min = 5, $max = 6), 'qow7' => $faker->numberBetween($min = 6, $max = 6), 'qow8' => $faker->numberBetween($min = 5, $max = 6), 'pffp1' => $faker->numberBetween($min = 5, $max = 6), 'pffp2' => $faker->numberBetween($min = 5, $max = 6), 'pffp3' => $faker->numberBetween($min = 5, $max = 6), 'pffp4' => $faker->numberBetween($min = 5, $max = 6), 'pffp5' => $faker->numberBetween($min = 5, $max = 6), 'pffp6' => $faker->numberBetween($min = 5, $max = 6), 'pffp7' => $faker->numberBetween($min = 5, $max = 6), 'pffp8' => $faker->numberBetween($min = 6, $max = 6), 'pffp9' => $faker->numberBetween($min = 6, $max = 6), 'pffp10' => $faker->numberBetween($min = 6, $max = 6), 'pffp11' => $faker->numberBetween($min = 6, $max = 6), 'comments' => $faker->text(100), 'status' => 'Finalized', 'semester' => '1st', 'year' => '2016']);
     }
     $updates = Performance::all();
     foreach ($updates as $update) {
         $saveUpdate = Performance::find($update->id);
         $u = $update->utilities;
         $qow = $update->workQuality;
         $pffp = $update->potential;
         $overall = number_format(($u + $qow + $pffp) / 3, 2);
         $saveUpdate->update(['util_overall' => $u, 'qow_overall' => $qow, 'pffp_overall' => $pffp, 'overall' => $overall]);
     }
 }