Example #1
0
 /**
  * Destroys the specified entry.
  *
  * @param int|string $id
  *
  * @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse
  */
 public function destroy($id)
 {
     $entry = $this->log->find($id);
     if ($entry) {
         if ($entry->delete()) {
             $this->message = 'Successfully deleted entry.';
             $this->messageType = 'success';
             $this->redirect = route('maintenance.admin.logs.index');
         } else {
             $this->message = 'There was an error trying to delete this entry. Please try again.';
             $this->messageType = 'danger';
             $this->redirect = routeBack('maintenance.admin.logs.index');
         }
         return $this->response();
     }
     return App::abort(404);
 }
 /**
  * Executes a mass action
  *
  * @return \Illuminate\Contracts\Routing\ResponseFactory|\Symfony\Component\HttpFoundation\Response
  */
 public function executeAction()
 {
     $action = request()->input('action');
     if (in_array($action, $this->actions)) {
         foreach (request()->input('rows', []) as $row) {
             if (!empty($row)) {
                 $entry = $this->reader->find($row);
                 switch ($action) {
                     case 'delete':
                         $entry->delete();
                         break;
                     case 'read':
                         $entry->markRead();
                         break;
                 }
             }
         }
         return response('Success');
     }
     return response('Failed', 500);
 }
Example #3
0
 public function testDateFailure()
 {
     $this->setExpectedException('Stevebauman\\LogReader\\Exceptions\\InvalidTimestampException');
     $this->logReader->date('test')->get();
 }