public function cycleTime() { return Info::where(DB::raw('MONTH(created_at)'), 7)->with('closure')->get()->map(function ($key) { return $this->getIssuedTimeAndClosedTime($key); })->map(function ($key) { return $this->getCycleTimeByHour($key); }); }
/** * Bind data to the view. * * @param View $view * @return void */ public function compose(View $view) { $view->with('charts', [['heading' => 'QDN METRICS <br> ', 'id' => 'modalQdnMetrics', 'title' => '', 'graph' => 'qdnMetricsGraph', 'table' => 'qdnMetricsTable'], ['heading' => 'PARETO OF DISCREPANCY <br> ', 'id' => 'pod', 'title' => '', 'graph' => 'podGraph', 'table' => 'podTable'], ['heading' => 'PARETO OF DISCREPANCY <br> ( FAILURE MODE )', 'id' => 'failureModeModal', 'title' => 'Pareto of Discrepancy - FAILURE MODE ', 'graph' => 'failureModeGraph', 'table' => 'failureModeTable'], ['heading' => 'PARETO OF DISCREPANCY <br> ( ASSEMBLY )', 'id' => 'assemblyModal', 'title' => 'Pareto of Discrepancy - ASSEMBLY ', 'graph' => 'assemblyGraph', 'table' => 'assemblyTable'], ['heading' => 'PARETO OF DISCREPANCY <br> ( ENVIRONMENT )', 'id' => 'environmentModal', 'title' => 'Pareto of Discrepancy - ENVIRONMENT ', 'graph' => 'environmentGraph', 'table' => 'environmentTable'], ['heading' => 'PARETO OF DISCREPANCY <br> ( MACHINE )', 'id' => 'machineModal', 'title' => 'Pareto of Discrepancy - MACHINE ', 'graph' => 'machineGraph', 'table' => 'machineTable'], ['heading' => 'PARETO OF DISCREPANCY <br> ( MAN )', 'id' => 'manModal', 'title' => 'Pareto of Discrepancy - MAN ', 'graph' => 'manGraph', 'table' => 'manTable'], ['heading' => 'PARETO OF DISCREPANCY <br> ( MATERIAL )', 'id' => 'materialModal', 'title' => 'Pareto of Discrepancy - MATERIAL ', 'graph' => 'materialGraph', 'table' => 'materialTable'], ['heading' => 'PARETO OF DISCREPANCY <br> ( METHOD / PROCESS )', 'id' => 'processModal', 'title' => 'Pareto of Discrepancy - METHOD / PROCESS ', 'graph' => 'processGraph', 'table' => 'processTable']]); $dt = Carbon::now('Asia/Manila'); $today = Info::where(DB::raw('DATE_FORMAT(created_at, "%m-%d-%Y")'), "=", $dt->format('m-d-Y'))->count(); $month = Info::where(DB::raw('MONTH(created_at)'), "=", $dt->month)->where(DB::raw('YEAR(created_at)'), "=", $dt->year)->count(); $week = Info::where(DB::raw('WEEK(created_at)'), "=", $dt->weekOfYear)->count(); $year = Info::where(DB::raw('YEAR(created_at)'), "=", $dt->year)->count(); $view->with('counts', [[$today, 'today-col', 'Issued today :', 'today', 'text-today'], [$week, 'week-col', 'Issued this week :', 'week', 'text-week'], [$month, 'month-col', 'Issued this month :', 'month', 'text-month'], [$year, 'year-col', 'Issued this year :', 'year', 'text-year']]); $yearOption = Info::select(DB::raw('YEAR(created_at) as year'))->groupBy('year')->get()->toArray(); $view->with('months', ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december']); $view->with('years', array_flatten($yearOption)); }
public static function issuedFrom($date) { $today = Carbon::now('Asia/Manila'); return collect(['today' => Info::where(DB::raw('DATE_FORMAT(created_at, "%m-%d-%Y")'), "=", $today->format('m-d-Y'))->get(), 'week' => Info::where(DB::raw('WEEK(created_at)'), "=", $today->weekOfYear)->get(), 'month' => Info::where(DB::raw('MONTH(created_at)'), "=", $today->month)->where(DB::raw('YEAR(created_at)'), "=", $today->year)->get(), 'year' => Info::where(DB::raw('YEAR(created_at)'), "=", $today->year)->get()])->get($date); }
/** * @return mixed */ public function getQdn() { $infoForMonth = Info::where(DB::raw('YEAR(created_at)'), $this->year())->where(DB::raw('MONTH(created_at)'), $this->month())->get(); $infoForYear = Info::where(DB::raw('YEAR(created_at)'), $this->year())->get(); return '' == $this->setMonth ? $infoForYear : $infoForMonth; }