public function home() { $page_title = "لوحة التحكم"; $section_title = "لوحة التحكم"; Date::setLocale('ar'); $date = Date::now()->format('j F Y'); $day = Date::now()->format('l'); $month = Date::now()->format('F'); $year = Date::now()->format('Y'); //**************Tasks*************** $tasksUnfinished = Task::unfinished(); $tasksToday = Task::orderBy('task_date', 'desc')->today()->take(5); $tasksWeek = Task::orderBy('task_date', 'desc')->thisweek()->take(5); $tasksMonth = Task::orderBy('task_date', 'desc')->thisMonth()->take(5); $tasks_count = count($tasksUnfinished->toArray()); //**************Fails*************** $failsunfixed = Failure::waiting(); $failsToday = Failure::orderBy('fail_time', 'desc')->today()->take(5); $failsWeek = Failure::orderBy('fail_time', 'desc')->thisweek()->take(5); $failsMonth = Failure::orderBy('fail_time', 'desc')->thisMonth()->take(5); $fails_count = count($failsunfixed->toArray()); //**************Repairs*************** $repairsBox = Repair::finished(); $repairsToday = Repair::today(); $repairsWeek = Repair::thisweek(); $repairsMonth = Repair::thisMonth(); $repairs_count = count($repairsBox); return view('dashboard.dashboard', compact('page_title', 'section_title', 'date', 'day', 'month', 'year', 'tasksToday', 'tasksMonth', 'tasksWeek', 'tasks_count', 'failsToday', 'failsMonth', 'failsWeek', 'fails_count', 'repairsToday', 'repairsMonth', 'repairsWeek', 'repairs_count')); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $failures = Failure::waiting(); $section_title = "الصيانة"; $page_title = "الأعطال"; $page_description = "سجل الأعطال"; return view('failures/index', compact('failures', 'page_title', 'page_description', 'section_title')); }