public function testAccessDeniedCompany()
 {
     $user = factory(\App\Entities\User::class)->create();
     $user->setUp();
     $this->actingAs($user);
     $this->visit('/contact/1/edit');
     $this->see(Lang::get('general.accessdenied'));
     $contact = Contact::find(1);
     $contact->companies()->delete();
     $contact->entries()->delete();
     $contact->models()->delete();
     $contact->tripsDriver()->delete();
     $contact->tripsVendor()->delete();
     $contact->users()->delete();
     $this->visit('/contact/destroy/1');
     $this->see(Lang::get('general.accessdenied'));
 }
 public function testDelete()
 {
     $idDelete = Contact::all()->last()['id'];
     factory(\App\Entities\Company::class)->create(['contact_id' => $idDelete]);
     $this->seeInDatabase('contacts', ['id' => $idDelete]);
     $this->visit('/contact/destroy/' . $idDelete)->seePageIs('/contact')->see('Este registro possui refer');
     $this->seeIsNotSoftDeletedInDatabase('contacts', ['id' => $idDelete]);
     $contact = Contact::find($idDelete);
     $contact->companies()->delete();
     $contact->entries()->delete();
     $contact->models()->delete();
     $contact->tripsDriver()->delete();
     $contact->tripsVendor()->delete();
     $contact->users()->delete();
     $this->seeInDatabase('contacts', ['id' => $idDelete]);
     $this->visit('/contact/destroy/' . $idDelete);
     $this->seeIsSoftDeletedInDatabase('contacts', ['id' => $idDelete]);
 }
예제 #3
0
 public function destroy($id)
 {
     Contact::find($id)->delete();
     return redirect()->route('agenda.index');
 }
예제 #4
0
 public function create($contactId)
 {
     $contact = Contact::find($contactId);
     return view('phones.create', compact('contact'));
 }
 public function show($idVehicle, $dateIni = null, $dateEnd = null)
 {
     $vehicle = $this->vehicleRepo->find($idVehicle);
     $this->helper->validateRecord($vehicle);
     $fleetData = $this->fleetRepo->getFleetData($vehicle->id);
     $localizationData = $this->vehicleRepo->getLocalizationData($idVehicle);
     $driverData = empty($localizationData->driver_id) ? "" : Contact::find($localizationData->driver_id);
     if (class_exists('Alientronics\\FleetanyWebReports\\Controllers\\ReportController')) {
         $objReportController = new ReportController($this->fleetRepo);
         $vehicleHistory = $objReportController->vehicleHistory($fleetData, $dateIni, $dateEnd);
         $tireSensorData = $vehicleHistory['tireSensorData'];
         $dateIni = $vehicleHistory['dateIni'];
         $timeIni = $vehicleHistory['timeIni'];
         $timeEnd = $vehicleHistory['timeEnd'];
     } else {
         $tireSensorData = [];
         $dateIni = "";
         $timeIni = "";
         $timeEnd = "";
     }
     return view("vehicle.show", compact('vehicle', 'fleetData', 'localizationData', 'driverData', 'tireSensorData', 'dateIni', 'timeIni', 'timeEnd'));
 }
예제 #6
0
 public function destroy($id)
 {
     $this->contact->find($id)->delete();
     return redirect()->route('contacts.index');
 }