Beispiel #1
0
 /**
  * Prepare an array of instantiable configuration instances.
  *
  * @param array $instances
  *
  * @return array
  */
 protected function prepareConfigValues(array $instances)
 {
     foreach ($instances as $key => $value) {
         $instances[$key] = $this->app->make($value);
     }
     return $instances;
 }
 /**
  * Validate a request.
  *
  * @param  \Symfony\Component\HttpFoundation\Request $request
  *
  * @return bool
  */
 public function validateRequest($request)
 {
     #TODO Need to Add more validation
     $passed = true;
     foreach ($this->validators as $validator) {
         $validator = $this->container->make($validator);
         if ($validator instanceof Validator && $validator->validate($request)) {
             $passed = true;
         }
     }
     // The accept validator will always be run once any of the previous validators have
     // been run. This ensures that we only run the accept validator once we know we
     // have a request that is targetting the API.
     if ($passed) {
         $this->container->make('Sunel\\Api\\Http\\Validation\\Accept')->validate($request);
     }
     return $passed;
 }
Beispiel #3
0
 /**
  * Get the route throttle.
  *
  * @return string|\Dingo\Api\Http\RateLimit\Throttle\Throttle
  */
 public function getThrottle()
 {
     if (is_null($this->throttle)) {
         $this->throttle = array_pull($this->action, 'throttle', []);
         $this->findControllerOptions('throttles', function ($value) {
             $this->throttle = $value['throttle'];
         });
         if (is_string($this->throttle)) {
             $this->throttle = $this->container->make($this->throttle);
         }
     }
     return $this->throttle;
 }