public function maintainance() { $page_title = "الصيانة التصحيحية"; $section_title = ""; $failures = Failure::orderBy('created_at', 'DESC')->take(5)->get(); return view('pages.maintainance', compact('page_title', 'section_title', 'failures')); }
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*************** $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($tasksToday->toArray()); //**************Fails*************** $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($failsToday->toArray()); //**************Repairs*************** $repairsToday = Repair::today(); $repairsWeek = Repair::thisweek(); $repairsMonth = Repair::thisMonth(); $repairs_count = count($repairsToday->toArray()); 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')); }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { $repair = Repair::findOrFail($id); $page_title = "تعديل إصلاح"; $part_names = DB::table('spare_parts')->lists('part_name'); $part_ids = DB::table('spare_parts')->lists('part_id'); $parts = array_combine($part_ids, $part_names); $tech_names = DB::table('technicans')->lists('tech_name'); $tech_ids = DB::table('technicans')->lists('id'); $technicans = array_combine($tech_ids, $tech_names); $fail = Failure::findOrFail($repair->fail_id); return view('repairs.repair_edit', compact('repair', 'technicans', 'parts', 'fail')); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($fail_id) { $failure = Failure::findOrFail($fail_id); $failure->delete(); return redirect('maintainance/failures')->withSuccess('The post was deleted.'); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($fail_id) { $failure = Failure::findOrFail($fail_id); $failure->delete(); return redirect()->route('failures.index')->withSuccess('The post was deleted.'); }
use Jenssegers\Date\Date; /* |-------------------------------------------------------------------------- | Application Routes |-------------------------------------------------------------------------- | | Here is where you can register all of the routes for an application. | It's a breeze. Simply tell Laravel the URIs it should respond to | and give it the controller to call when that URI is requested. | */ Route::get('/home', function () { return redirect('/dash'); }); Route::get('/table', function () { $failures = Failure::all(); return view('failures.table', compact('failures')); }); // Authentication routes... Route::get('auth/login', 'Auth\\AuthController@getLogin'); Route::post('auth/login', 'Auth\\AuthController@postLogin'); Route::get('auth/logout', 'Auth\\AuthController@getLogout'); // Registration routes... /* Route::get('auth/register', 'Auth\AuthController@getRegister'); Route::post('auth/register', 'Auth\AuthController@postRegister'); */ // Password reset link request routes... Route::get('password/email', 'Auth\\PasswordController@getEmail'); Route::post('password/email', 'Auth\\PasswordController@postEmail'); // Password reset routes...
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $repair = Repair::findOrFail($id); $repair->delete(); $fail = Failure::findOrFail($repair->failure->fail_id); $fail->status = 0; $fail->save(); return redirect('maintainance/repairs/waiting')->withSuccess('تم حذف التقرير بنجاح'); }