Example #1
0
 public function dashboard(Request $reuest, Driver $drivers)
 {
     $user = User::find(auth()->user()->id);
     $user->birthdaysToday = $drivers->getBirthdaysTodayCount();
     $user->birthdaysThisMonth = $drivers->getBirthdaysThisMonthCount();
     $user->birthdaysNextMonth = $drivers->getBirthdaysNextMonthCount();
     $user->todosCount = $user->todosCount();
     $user->driversCount = $drivers->count();
     return view('dashboard.index', compact('user'));
 }
Example #2
0
 public function changePassword(Request $request)
 {
     if ($request->input('user') == 'passenger') {
         $user = new Passenger();
         return $user->changePassword($request->input('contactNo'), $request->input('password'));
     } elseif ($request->input('user') == 'driver') {
         $user = new Driver();
         return $user->changePassword($request->input('contactNo'), $request->input('password'));
     }
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['name' => 'required|max:255', 'contact' => 'numeric|min:10', 'g_photo' => 'image|max:1024', 'photo' => 'image|max:1024', 'license_photo' => 'image|max:1024']);
     $input = $this->getAll($request, 'store', '');
     Driver::create($input);
     flash()->success('Driver Created Successfully !');
     return redirect('driver');
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create();
     $limit = 40;
     for ($i = 0; $i < $limit; $i++) {
         Driver::create(['email' => $faker->unique()->email, 'name' => $faker->firstName, 'phone' => $faker->phoneNumber, 'license_no' => rand(100000, 999999), 'pco_license_no' => rand(100000, 999999), 'dob' => $faker->date('d-m-Y')]);
     }
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     //
     $validator = Validator::make($request->all(), ['firstname' => 'required|min:2', 'lastname' => 'required|min:2', 'middlename' => 'required|min:2', 'email' => 'required|min:5|unique:drivers', 'phone' => 'required|min:5|unique:drivers']);
     if ($validator->fails()) {
         if ($request->ajax()) {
             return response()->json($validator->messages());
         } else {
             return \Redirect::back()->withErrors($validator)->withInput();
         }
     }
     $all_request = $request->all();
     array_forget($all_request, "_token");
     $driver = new Driver();
     foreach ($all_request as $key => $value) {
         $driver->{$key} = $value;
     }
     if ($driver->save()) {
         return response()->json("record saved successfully");
     }
     return View("drivers.index", ["drivers" => Driver::all(), "title" => "Drivers' Listing"]);
 }
Example #6
0
 public function birthdays(Driver $drivers)
 {
     $drivers->birthdaysToday = $drivers->getBirthdaysToday();
     $drivers->birthdaysThisMonth = $drivers->getBirthdaysThisMonth();
     $drivers->birthdaysNextMonth = $drivers->getBirthdaysNextMonth();
     return view('drivers.birthdays', compact('drivers'));
 }
Example #7
0
 public function store(RegisterDriverRequest $request)
 {
     Driver::create($request->all());
     return redirect(url('admin/driver/all'));
 }
Example #8
0
 public function __construct(Truck $truck, Driver $driver, State $state)
 {
     $this->truck = $truck->where('company_id', Auth::user()->company_id)->where('account_year_id', session('account'));
     $this->driver = $driver->where('company_id', Auth::user()->company_id)->where('account_year_id', session('account'));
     $this->state = $state->where('company_id', Auth::user()->company_id)->where('account_year_id', session('account'));
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  Driver $driver
  * @return \Illuminate\Http\Response
  */
 public function destroy(Driver $driver)
 {
     $driver->delete();
     Session::flash('flash_message', 'Driver deleted successfully!');
     return Redirect::route('driver.index')->with('message', 'Driver deleted.');
 }
Example #10
0
    /**
     * ===========================================================
     * Contacts
     */
    Route::get('contacts/search', ['as' => 'admin.contacts.search', 'uses' => 'ContactsController@search']);
    Route::post('contacts/image/{id}', ['as' => 'admin.contacts.image', 'uses' => 'ContactsController@postImage']);
    Route::bind('contacts', function ($id) {
        return App\Contact::whereUserId(auth()->user()->id)->findOrFail($id);
    });
    Route::resource('contacts', 'ContactsController', []);
    /**
     * Drivers
     */
    Route::get('drivers/birthdays', ['as' => 'admin.drivers.birthdays', 'uses' => 'DriversController@birthdays']);
    Route::get('drivers/search', ['as' => 'admin.drivers.search', 'uses' => 'DriversController@search']);
    Route::post('drivers/image/{id}', ['as' => 'admin.drivers.image', 'uses' => 'DriversController@postImage']);
    Route::bind('drivers', function ($id) {
        return \App\Driver::findOrFail($id);
    });
    Route::resource('drivers', 'DriversController');
    /**
     * Todos
     */
    Route::get('todos/completar/{id}', ['as' => 'admin.todos.completar', 'uses' => 'TodosController@completar']);
    Route::get('todos/incompletar/{id}', ['as' => 'admin.todos.incompletar', 'uses' => 'TodosController@incompletar']);
    Route::delete('todos/remove_done_tasks', ['as' => 'admin.todos.remove_done_tasks', 'uses' => 'TodosController@removeDoneTasks']);
    Route::bind("todos", function ($id) {
        return \App\Todo::whereUserId(Auth::user()->id)->findOrFail($id);
    });
    Route::resource('todos', 'TodosController', []);
});
Example #11
0
 public function getAvailableDrivers()
 {
     $driver = new Driver();
     return $driver->getAvailableDrivers();
 }
Example #12
0
 public function single($id)
 {
     $driver = Driver::with('user')->find($id);
     return view('pages.driver', compact('driver'));
 }
Example #13
0
 public function storeDriver(Request $request)
 {
     $driver = Driver::create($request->all());
     $driver->save();
     return redirect('investor/drivers');
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $driver = new Driver();
     $dataDriver = $driver->find($id);
     if (isset($dataDriver->id)) {
         $driver->destroy($id);
         return response()->json(['status' => 'success', 'messages' => 'delete successfully']);
     }
     return response()->json(['status' => 'fail', 'messages' => 'Not Found Driver With ID=' . $id]);
 }