Skip to content

Commit

Permalink
Merge branch '0.5' of github.com:esensi/core
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel LaBarge committed Jan 29, 2018
2 parents f9dd33e + 54157cf commit 7ae6967
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 16 deletions.
2 changes: 1 addition & 1 deletion config/core.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
'App\Http\Middleware\CsrfTokenVerifier' => Esensi\Core\Http\Middleware\CsrfTokenVerifier::class,
'App\Http\Middleware\RateLimiter' => Esensi\Core\Http\Middleware\RateLimiter::class,
'App\Http\Middleware\RobotsIndexer' => Esensi\Core\Http\Middleware\RobotsIndexer::class,
'App\Http\Requests\Request' => Esensi\Core\Http\Requestss\Request::class,
'App\Http\Requests\Request' => Esensi\Core\Http\Requests\Request::class,
'App\Jobs\Job' => Esensi\Core\Jobs\Job::class,
'App\Models\Collection' => Esensi\Core\Models\Collection::class,
'App\Models\Model' => Esensi\Core\Models\Model::class,
Expand Down
4 changes: 4 additions & 0 deletions config/validation.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,8 @@
'less_than_other' => Esensi\Core\Extensions\ComparisonValidator::class,
],

'implicit_extensions' => [

],

];
6 changes: 3 additions & 3 deletions src/Contracts/RenderErrorExceptionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Esensi\Core\Contracts;

use ErrorException;
use Exception;

/**
* Render Error Exception Interface
Expand All @@ -19,9 +19,9 @@ interface RenderErrorExceptionInterface
* Render a Repository Exception into an HTTP respons.
*
* @param \Illuminate\Http\Request $request
* @param \ErrorException $e
* @param \Exception $e
* @return \Illuminate\Http\Response
*/
public function renderErrorException($request, ErrorException $e);
public function renderErrorException($request, Exception $e);

}
4 changes: 1 addition & 3 deletions src/Exceptions/RepositoryException.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,8 @@ public function __construct($bag, $message = null, $code = 0, Exception $previou
}

// Save the properties
parent::__construct($message, $code, $previous);
$this->bag = $bag;
$this->message = $message;
$this->code = $code;
$this->previous = $previous;
}

/**
Expand Down
File renamed without changes.
3 changes: 2 additions & 1 deletion src/Http/Middleware/RateLimiter.php
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,8 @@ public function render(Request $request)
}

// Make a new response
$response = response($content, $code)->headers->set('Content-Type', $contentType, true);
$response = response($content, $code);
$response->headers->set('Content-Type', $contentType, true);
return $response;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Http/Middleware/RobotsIndexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function render($request)
*/
public function addHeaders(Response $response)
{
$response->header('X-Robots-Tag', 'noindex, nofollow, noarchive', true);
$response->headers->set('X-Robots-Tag', 'noindex, nofollow, noarchive', true);
return $response;
}

Expand Down
14 changes: 12 additions & 2 deletions src/Providers/ValidationServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,18 @@ public function register()
$extensions = config('esensi/core::validation.extensions', []);
foreach( $extensions as $extension => $class)
{
$validator->extend($extension, $class . '@validate' . ucfirst(studly_case($extension)));
$validator->replacer($extension, $class . '@replace' . ucfirst(studly_case($extension)));
$method = ucfirst(studly_case($extension));
$validator->extend($extension, $class . '@validate' . $method);
$validator->replacer($extension, $class . '@replace' . $method);
}

// Add validation implicit extensions
$extensions = config('esensi/core::validation.implicit_extensions', []);
foreach( $extensions as $extension => $class)
{
$method = ucfirst(studly_case($extension));
$validator->extendImplicit($extension, $class . '@validate' . $method);
$validator->replacer($extension, $class . '@replace' . $method);
}

return $validator;
Expand Down
4 changes: 2 additions & 2 deletions src/Traits/ConfirmableControllerTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ trait ConfirmableControllerTrait
*
* @var array
*/
protected $trashableActions = [ 'restore', 'delete', 'bulkRestore', 'bulkDelete' ];
protected $trashableActions = [ 'restore', 'delete', 'bulk_restore', 'bulk_delete' ];

/**
* Display a confirmation modal for the specified resource action.
Expand Down Expand Up @@ -86,7 +86,7 @@ public function confirmBulk($action, $ids = null)

// Get the resources as a collection
$collection = $this->getRepository()
->findIn('id', $ids);
->findIn('id', $ids, $inTrash);

// Pass collection under the plural package named variable to the view
$data = [ str_plural($this->package) => $collection, 'ids' => $ids ];
Expand Down
6 changes: 3 additions & 3 deletions src/Traits/RenderErrorExceptionTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Esensi\Core\Traits;

use ErrorException;
use Exception;

/**
* Trait that renders ErrorExceptions
Expand All @@ -20,10 +20,10 @@ trait RenderErrorExceptionTrait
* Render an error exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \ErrorException $e
* @param \Exception $e
* @return \Illuminate\Http\Response
*/
public function renderErrorException($request, ErrorException $e)
public function renderErrorException($request, Exception $e)
{
// Skip custom error views when in debug mode
if( config('app.debug') )
Expand Down

0 comments on commit 7ae6967

Please sign in to comment.