public function delete($id)
 {
     if ($this->shouldLockIfNoPermission('data.edit')) {
         return;
     }
     $modelPart = new Part($this->db);
     $part = $modelPart->findById($id);
     if ($this->request->is('post')) {
         $modelPart->deleteById($id);
         $this->flash->success('Deleted part successfully!');
         if (null !== $part) {
             return $this->redirect('/devices/view/' . $part['device_id']);
         }
         return $this->redirect('/customers');
     }
     $modelDevice = new Device($this->db);
     $device = $modelDevice->findById($part['device_id']);
     $this->set('device', $device);
     $this->set('id', $id);
 }