Ejemplo n.º 1
1
 /**
  * Get the API ancestor controller class
  * of the current controller class.
  *
  * @return Esensi\Core\Http\Controllers\ApiController
  */
 public function api()
 {
     // Make a copy of the parent class
     $class = get_parent_class();
     $parent = App::make($class);
     // Copy over the packaged properties
     if ($this instanceof PackagedInterface) {
         $parent->setUI($this->getUI());
         $parent->setPackage($this->getPackage());
         $parent->setNamespacing($this->getNamespacing());
     }
     // Copy over the injected repositories
     if ($this instanceof RepositoryInjectedInterface) {
         foreach ($this->repositories as $name => $repository) {
             $parent->setRepository($repository, $name);
         }
     }
     // Return first ApiController ancestor found
     if (str_contains($class, 'ApiController')) {
         return $parent;
     }
     // Recursively look up the parent class
     if (method_exists($parent, 'api')) {
         return $parent->api();
     }
     // Return the parent class found already
     return $parent;
 }
Ejemplo n.º 2
0
 /**
  * Do the Artisan commands fire?
  */
 public function testCommands()
 {
     $self = $this;
     $this->prepareSpecify();
     $this->specify('Boots', function () use($self) {
         $target = $self->getProvider(['package']);
         $target->shouldReceive('package');
         $target->boot();
     });
     $this->prepareSpecify();
     $this->specify('Identifies provisions', function () use($self) {
         $target = $self->getProvider();
         verify($target->provides())->notEmpty();
     });
     $this->prepareSpecify();
     $this->specify('Binds to application', function () use($self) {
         App::shouldReceive('bind')->with('/^toolbox\\.commands\\./', Mockery::on(function ($closure) {
             $command = $closure();
             verify_that('is a command', is_a($command, 'Illuminate\\Console\\Command'));
             return true;
         }));
         Event::shouldReceive('listen')->with('toolbox.build', Mockery::on(function ($closure) {
             $app = Mockery::mock('Illuminate\\Console\\Application[call]');
             $app->shouldReceive('call');
             $command = $closure($app);
             return true;
         }));
         $target = $self->getProvider(['commands']);
         $target->shouldReceive('commands')->with(Mockery::type('array'));
         $target->register();
     });
 }
Ejemplo n.º 3
0
 /**
  * @param string $lang
  */
 private function setSupportedLanguage($lang)
 {
     if ($this->isLanguageSupported($lang)) {
         App::setLocale($lang);
         Session::put('lang', $lang);
     }
 }
 /**
  * Display the password reset view for the given token.
  *
  * @param  string  $token
  * @return \Response
  */
 public function getReset($token = null)
 {
     if (is_null($token)) {
         App::abort(404);
     }
     $this->view('password.reset', ['token' => $token]);
 }
Ejemplo n.º 5
0
 /**
  * Display the content of the page
  *
  * @param $query
  * @return \Illuminate\View\View
  */
 public function display($query)
 {
     $title = 'TestView';
     $page = "";
     $arr = explode('/', $query);
     // \App\Page::find(4)->content->find(5)->element->module->name
     $heading = \App\Node::findBySlug('header');
     //        dd(\App\Node::findBySlug($arr[0])->content);
     // test
     $content = \App\Node::active()->findBySlug($arr[0])->content;
     foreach ($content as $item) {
         // get the module Name of
         //            $module = \App\Module::findOrFail($p->module_id);
         // resolve the Module Name out of the IOC Container and render the content partiall
         //            $content .= App::make('module:' . $module->name)->render($p->content_id);
         //            foreach ($item->content as $content)
         //            {
         //Todo check if Module is Active and Content is Active
         $module = $item->element->module->name;
         if ($module != 'Heading') {
             continue;
         }
         // resolve the Module out of the IOC Container and render the partial
         $page .= App::make('module:' . strtolower($module))->render($item->element->row);
         //            }
     }
     return view('layout.master', compact('title', 'page'));
 }
Ejemplo n.º 6
0
 public function getTraining()
 {
     $training = new \Offside\Team\Training($this->trainingRepository);
     $javascript = App::make('Javascript');
     $javascript::put(['attackTraining' => $training->getAttackDateTime(), 'midfieldTraining' => $training->getMidfieldDateTime(), 'defenseTraining' => $training->getDefenseDateTime(), 'anyTrainingActive' => !$training->allTrainingsDone(), 'elapsedTime' => $training->getElapsedTime()]);
     return view("my-team.training");
 }
    protected function bootSilverstripe($url = null)
    {
        $flush = $this->option('flush');
        // to allow the Silverstripe command line to know what the server URL should be ...
        // sadly, setting a global $_FILE_TO_URL_MAPPING variable is not enough because Silverstripe's Core.php (or
        // Constants.php in newer versions) doesn't declare it as global - it assumes it's declared in the
        // _ss_environment.php file which is _included_ not _required_. Boo.
        //        global $_FILE_TO_URL_MAPPING;
        //        $_FILE_TO_URL_MAPPING[base_path()] = Config::get('app.url');
        $base = base_path();
        $envPath = $base . '/_ss_environment.php';
        if (!file_exists($envPath)) {
            $appUrl = Config::get('app.url');
            file_put_contents($envPath, <<<EOT
<?php
global \$_FILE_TO_URL_MAPPING;
\$_FILE_TO_URL_MAPPING['{$base}'] = '{$appUrl}';
EOT
);
            App::shutdown(function ($app) use($envPath) {
                unlink($envPath);
            });
        }
        // taken from silverstripe's framework/cli-script.php
        if ($flush) {
            $_REQUEST['flush'] = $flush === true ? 1 : $flush;
            $_GET['flush'] = $flush === true ? 1 : $flush;
        }
        if ($url) {
            $_REQUEST['url'] = $url;
            $_GET['url'] = $url;
        }
        Silverstripe::start();
    }
 /**
  * Handle the command
  *
  * @param BaseCommand|RegisterUserCommand $command
  *
  * @return mixed
  */
 public function handle(BaseCommand $command)
 {
     $user = new User($command->all());
     $user->save();
     App::make('Altwallets\\Services\\UserMailer')->sendRegistrationEmail($user);
     return $user;
 }
Ejemplo n.º 9
0
 /**
  * Register the application services.
  *
  * @return void
  */
 public function register()
 {
     $this->mergeConfigFrom(__DIR__ . '/../../config/smsc.php', 'smsc');
     App::bind('smsc', function () {
         return new Smsc();
     });
 }
Ejemplo n.º 10
0
 /**
  * @test
  */
 public function it_should_fire_job_with_unresolvable_models()
 {
     /**
      *
      * Set
      *
      */
     App::shouldReceive('make')->with('menthol.flexible.proxy', Mockery::any())->once()->andReturn('mock');
     $app = m::mock('Illuminate\\Foundation\\Application');
     $config = m::mock('Menthol\\Flexible\\Config');
     $logger = m::mock('Monolog\\Logger');
     $job = m::mock('Illuminate\\Queue\\Jobs\\Job');
     $models = ['Husband:99999'];
     /**
      *
      * Expectation
      *
      */
     $logger->shouldReceive('info')->with('Indexing Husband with ID: 99999');
     $logger->shouldReceive('error')->with('Indexing Husband with ID: 99999 failed: No query results for model [Husband].');
     $config->shouldReceive('get')->with('logger', 'menthol.flexible.logger')->andReturn('menthol.flexible.logger');
     $app->shouldReceive('make')->with('menthol.flexible.logger')->andReturn($logger);
     $job->shouldReceive('delete')->once();
     $job->shouldReceive('release')->with(60)->once();
     /**
      *
      * Assertion
      *
      */
     with(new ReindexJob($app, $config))->fire($job, $models);
 }
Ejemplo n.º 11
0
 public function __construct()
 {
     $this->request = App::make('request');
     $this->config = App::make('config');
     $this->restResponse = App::make('Noherczeg\\RestExt\\Services\\ResponseComposer');
     $this->linker = App::make('Noherczeg\\RestExt\\Services\\Linker');
     $this->restExt = App::make('Noherczeg\\RestExt\\RestExt');
     if ($this->accessPolicy === null) {
         $this->accessPolicy = $this->config->get('restext::access_policy');
     }
     // if we set the property it should override the Accept Header even if it it is set otherwise in the configs
     if ($this->produces !== null) {
         $this->produce($this->produces);
     }
     $securityRoles = $this->securityRoles;
     $accessPolicy = $this->accessPolicy;
     // Default actions
     $this->beforeFilter(function () use($securityRoles, $accessPolicy) {
         // To prevent processing / returning of content if by default the access policy is set to
         // "whitelist" and no allowed roles have been set.
         if ($accessPolicy == 'whitelist' && count($securityRoles) == 0) {
             throw new PermissionException();
         }
         // If the "prefer_accept" configuration is set to true, we set RestResponse to send the MediaType given in
         // the Accept Header if it's compatible with our system. If not we set it to the default config's value.
         if ($this->config->get('restext::prefer_accept')) {
             if (in_array($this->requestAccepts(), $this->restResponse->getSupportedMediaTypes())) {
                 $this->restResponse->setMediaType($this->requestAccepts());
             }
             $this->restResponse->setMediaType($this->config->get('restext::media_type'));
         }
     });
 }
Ejemplo n.º 12
0
 /**
  * Profiler constructor.
  */
 public function __construct()
 {
     $this->profiler = App::make('profiler');
     if ($this->profiler instanceof NullProfiler) {
         abort(500, 'Profiler is not instantiate correctly.');
     }
 }
Ejemplo n.º 13
0
 /**
  * @expectedException \Publiux\laravelcdn\Exceptions\MissingConfigurationException
  */
 public function testCreateThrowsExceptionWhenMissingDefaultConfiguration()
 {
     $configurations = ['default' => ''];
     $m_aws_s3 = M::mock('Publiux\\laravelcdn\\Providers\\AwsS3Provider');
     \Illuminate\Support\Facades\App::shouldReceive('make')->once()->andReturn($m_aws_s3);
     $this->provider_factory->create($configurations);
 }
Ejemplo n.º 14
0
 /**
  * Returns an html icon class of the type of
  * notification by retrieving it from the configuration file.
  *
  * @return string|null
  */
 public function getIconAttribute()
 {
     $class = $this->attributes['notifiable_type'];
     /*
      * Resolve the configuration service from the IoC since
      * we don't want to override the Notification models constructor
      * to inject the service
      */
     $config = App::make(ConfigService::class);
     // Make sure we have an instance of the ConfigService returned by the IoC
     if ($config instanceof ConfigService) {
         $icon = $config->setPrefix('maintenance')->get("notifications.icons.{$class}");
         // Return the models notification icon if it's found
         if (is_string($icon) && !empty($icon)) {
             return $icon;
         }
         /*
          * Looks like the notification icon could not be
          * found, we'll return the default notification icon
          */
         $defaultIcon = $config->setPrefix('maintenance')->get('notifications.icons.default');
         return $defaultIcon;
     }
     return;
 }
Ejemplo n.º 15
0
 /**
  * Register any package services.
  *
  * @return void
  */
 public function register()
 {
     App::bind('VKAPI', function () {
         return new VKAPIClass(config('VKAPI.access_token'), config('VKAPI.version'), config('VKAPI.api_url'));
     });
     $this->publishes([__DIR__ . '/../config/VKAPI.php' => config_path('VKAPI.php')]);
 }
Ejemplo n.º 16
0
 /**
  * Execute the console command.
  */
 public function handle()
 {
     if (!preg_match('/' . Config::get('laravel-hash-store::config.filter', '^.+$') . '/', $this->argument('key'))) {
         throw new Exception('Invalid hash key!');
     }
     $this->line('Hash created: ' . App::make('HashStore')->create($this->argument('key')));
 }
Ejemplo n.º 17
0
 /**
  * @param Proxy $proxy
  * @param string $name
  */
 public function __construct(Proxy $proxy, $name = '')
 {
     self::$client = App::make('Elasticsearch');
     self::$config = App::make('Menthol\\Flexible\\Config');
     $this->setProxy($proxy);
     $this->setName($name ?: $proxy->getModel()->getTable());
 }
Ejemplo n.º 18
0
 /**
  * Index action.
  *
  * @return mixed
  */
 public function getIndex($type = null)
 {
     $container = Input::get('c');
     $files = Input::get('files', '');
     if (empty($type) || !in_array($type, array('style', 'script'))) {
         App::abort(404);
     }
     if (empty($container)) {
         App::abort(404);
     }
     $files = json_decode(base64_decode($files), true);
     if (empty($files) || !is_array($files)) {
         App::abort(404);
     }
     foreach ($files as $file) {
         Casset::container($container)->add(array_get($file, 'source'), array(), array_get($file, 'dependencies', array()));
     }
     $response = Response::make(Casset::container($container)->content($type));
     if ('style' == $type) {
         $response->headers->set('Content-Type', 'text/css');
     } else {
         $response->headers->set('Content-Type', 'application/json');
     }
     return $response;
 }
 /**
  * Register the HTML builder instance.
  * This binds the 'html' reference in the IoC container to the package implementation.
  * Laravel's HTML Facade will automatically use this when being called
  *
  * @return void
  */
 protected function registerHtmlBuilder()
 {
     $this->app->bindShared('html', function ($app) {
         $urlGenerator = App::make(UrlGenerator::class);
         return new HtmlBuilder($urlGenerator);
     });
 }
 public function getInputs($inputs)
 {
     $inputs['datetime_ini'] = HelperRepository::date($inputs['datetime_ini'], App::getLocale());
     $inputs['datetime_end'] = HelperRepository::date($inputs['datetime_end'], App::getLocale());
     $inputs['cost'] = HelperRepository::money($inputs['cost'], App::getLocale());
     return $inputs;
 }
 /**
  * Retrieve a user by the given credentials.
  * This will first authenticate against ldap before loading the user with eloquent
  * @param  array  $credentials
  * @return \Illuminate\Auth\UserInterface|null
  */
 public function retrieveByCredentials(array $credentials)
 {
     $username = $credentials['username'];
     $user = $this->createModel()->query()->where('username', $username)->first();
     if ($user == null && ($this->config['autoRegister'] || isset($credentials['isRegister']))) {
         //if our user wasn't found, and we have auto register enabled or we're coming from the user registration
         //directly, then we'll attempt an authentication and take the appropriate action.
         $ldap_info = $this->getAdLdap()->user()->info($username);
         if ($ldap_info['count'] != 1) {
             return null;
         }
         if ($this->getAdLdap()->authenticate($ldap_info[0]['dn'], $credentials['password'])) {
             if ($this->config['autoRegister']) {
                 //if we have auto register enabled, create a user and such using the ldap info.
                 $ldapInfo = $this->getAdLdap()->user()->info($username, array("givenname", "sn"))[0];
                 $userInfo = array();
                 $userInfo['firstname'] = isset($ldapInfo['givenname']) ? $ldapInfo['givenname'][0] : $username;
                 $userInfo['lastname'] = isset($ldapInfo['sn']) ? $ldapInfo['sn'][0] : '';
                 $userInfo['username'] = $username;
                 $userInfo['password'] = '******';
                 $user = App::make('UserRegistrator')->registerUser($userInfo, $this->config['registrationLanguage']);
             } elseif (isset($credentials['isRegister'])) {
                 //if we're not auto registering, but this is the registration process,
                 //we need to return a valid UserInterface object so that Guard will
                 //pass the authentication and actually continue with the registration process.
                 //This is necessary because we don't allow users that can't authenticate to ldap to register
                 $user = new GenericUser(array("id" => $username));
             }
         }
     }
     return $user;
 }
Ejemplo n.º 22
0
 public function __construct(QueryStringOperations $qso)
 {
     $this->queryStringOps = $qso;
     $this->request = App::make('request');
     $this->url = App::make('url');
     $this->config = App::make('config');
 }
Ejemplo n.º 23
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     //
     $pusher = App::make('pusher');
     $pusher->trigger('test_channel', 'my_event', array('text' => Hash::make('pusher')));
     return view('chat');
 }
Ejemplo n.º 24
0
function phone_format($phone, $country, $format = null)
{
    $lib = App::make('libphonenumber');
    $phoneNumber = $lib->parse($phone, $country);
    $format = is_null($format) ? PhoneNumberFormat::INTERNATIONAL : $format;
    return $lib->format($phoneNumber, $format);
}
Ejemplo n.º 25
0
 /**
  * Integration Test.
  */
 public function testPushCommand()
 {
     $configuration_file = ['bypass' => false, 'default' => 'AwsS3', 'url' => 'https://s3.amazonaws.com', 'threshold' => 10, 'providers' => ['aws' => ['s3' => ['region' => 'us-standard', 'version' => 'latest', 'buckets' => ['my-bucket-name' => '*'], 'acl' => 'public-read', 'cloudfront' => ['use' => false, 'cdn_url' => ''], 'metadata' => [], 'expires' => gmdate('D, d M Y H:i:s T', strtotime('+5 years')), 'cache-control' => 'max-age=2628000', 'version' => '']]], 'include' => ['directories' => [__DIR__], 'extensions' => [], 'patterns' => []], 'exclude' => ['directories' => [], 'files' => [], 'extensions' => [], 'patterns' => [], 'hidden' => true]];
     $m_consol = M::mock('Symfony\\Component\\Console\\Output\\ConsoleOutput');
     $m_consol->shouldReceive('writeln')->atLeast(1);
     $finder = new \Vinelab\Cdn\Finder($m_consol);
     $asset = new \Vinelab\Cdn\Asset();
     $provider_factory = new \Vinelab\Cdn\ProviderFactory();
     $m_config = M::mock('Illuminate\\Config\\Repository');
     $m_config->shouldReceive('get')->with('cdn')->once()->andReturn($configuration_file);
     $helper = new \Vinelab\Cdn\CdnHelper($m_config);
     $m_console = M::mock('Symfony\\Component\\Console\\Output\\ConsoleOutput');
     $m_console->shouldReceive('writeln')->atLeast(2);
     $m_validator = M::mock('Vinelab\\Cdn\\Validators\\Contracts\\ProviderValidatorInterface');
     $m_validator->shouldReceive('validate');
     $m_helper = M::mock('Vinelab\\Cdn\\CdnHelper');
     $m_spl_file = M::mock('Symfony\\Component\\Finder\\SplFileInfo');
     $m_spl_file->shouldReceive('getPathname')->andReturn('vinelab/cdn/tests/Vinelab/Cdn/AwsS3ProviderTest.php');
     $m_spl_file->shouldReceive('getRealPath')->andReturn(__DIR__ . '/AwsS3ProviderTest.php');
     // partial mock
     $p_aws_s3_provider = M::mock('\\Vinelab\\Cdn\\Providers\\AwsS3Provider[connect]', array($m_console, $m_validator, $m_helper));
     $m_s3 = M::mock('Aws\\S3\\S3Client')->shouldIgnoreMissing();
     $m_s3->shouldReceive('factory')->andReturn('Aws\\S3\\S3Client');
     $m_command = M::mock('Aws\\Command');
     $m_s3->shouldReceive('getCommand')->andReturn($m_command);
     $m_s3->shouldReceive('execute');
     $p_aws_s3_provider->setS3Client($m_s3);
     $p_aws_s3_provider->shouldReceive('connect')->andReturn(true);
     \Illuminate\Support\Facades\App::shouldReceive('make')->once()->andReturn($p_aws_s3_provider);
     $cdn = new \Vinelab\Cdn\Cdn($finder, $asset, $provider_factory, $helper);
     $result = $cdn->push();
     assertEquals($result, true);
 }
Ejemplo n.º 26
0
 /**
  * Return available payment methods by country and payment group
  * Method parameters can be set via config
  *
  * @param string [Optional] $country
  * @param array [Optional] $payment_groups_names
  * @return array
  */
 public static function getPaymentMethods($country = null, $payment_groups_names = null)
 {
     $payment_methods_info = WebToPay::getPaymentMethodList(intval(config('paysera.projectid')), config('paysera.currency'));
     $country_code = !is_null($country) ? $country : strtolower(config('paysera.country'));
     $payment_methods_info->setDefaultLanguage(App::getLocale());
     $result = [];
     $country_payment_methods_info = $payment_methods_info->getCountry($country_code);
     $result['country_code'] = $country_payment_methods_info->getCode();
     $result['country_title'] = $country_payment_methods_info->getTitle();
     $payment_methods_groups_all = $country_payment_methods_info->getGroups();
     if ($payment_groups_names == null) {
         $payment_groups_names = config('paysera.payment_groups');
     }
     foreach ($payment_groups_names as $payment_groups_name) {
         $payment_methods_groups[$payment_groups_name] = $payment_methods_groups_all[$payment_groups_name];
         $result['payment_groups'][$payment_groups_name]['title'] = $payment_methods_groups_all[$payment_groups_name]->getTitle(App::getLocale());
         foreach ($payment_methods_groups_all[$payment_groups_name]->getPaymentMethods() as $key => $method) {
             $tmp = [];
             $tmp['title'] = $method->getTitle(App::getLocale());
             $tmp['key'] = $key;
             $tmp['currency'] = $method->getBaseCurrency();
             $tmp['logo_url'] = $method->getLogoUrl();
             $tmp['object'] = $method;
             $result['payment_groups'][$payment_groups_name]['methods'][$key] = $tmp;
         }
     }
     return $result;
 }
 /**
  * @test
  */
 public function it_should_bind_index()
 {
     /**
      * Set
      */
     App::clearResolvedInstances();
     App::shouldReceive('make')->with('menthol.flexible.index', m::any())->once()->andReturn('mock');
     App::shouldReceive('make')->with('Elasticsearch')->twice()->andReturn('mock');
     $config = m::mock('Menthol\\Flexible\\Config');
     App::shouldReceive('make')->with('Menthol\\Flexible\\Config')->once()->andReturn($config);
     $config->shouldReceive('get')->with('elasticsearch.index_prefix', '')->andReturn('');
     $model = m::mock('Illuminate\\Database\\Eloquent\\Model');
     $model->shouldReceive('getTable')->once()->andReturn('mockType');
     $app = m::mock('LaravelApp');
     $proxy = m::mock('Menthol\\Flexible\\Proxy', [$model]);
     $sp = m::mock('Menthol\\Flexible\\FlexibleServiceProvider[bindIndex]', [$app]);
     /**
      * Expectation
      */
     $app->shouldReceive('bind')->once()->andReturnUsing(function ($name, $closure) use($app, $proxy) {
         $this->assertEquals('menthol.flexible.index', $name);
         $this->assertInstanceOf('Menthol\\Flexible\\Index', $closure($app, ['proxy' => $proxy, 'name' => 'name']));
     });
     /**
      * Assertion
      */
     $sp->bindIndex();
 }
Ejemplo n.º 28
0
 public function testInstallationAlreadyCompleted()
 {
     $this->mockAccountManagementService->shouldReceive('totalNumberOfAccounts')->andReturn(1);
     App::shouldReceive('abort')->with(404)->once();
     $this->middleware->handle('request', function () {
     });
 }
 public function getIndex($profileId)
 {
     $profile = Profile::where('id', '=', $profileId)->first();
     if ($profile && $profile->isActive == 1) {
         session(['profileId' => $profileId]);
         $vote = Vote::where(['user_id' => Auth::id(), 'profile_id' => $profileId])->first();
         $voted = false;
         if ($vote && $vote->isActive == 1) {
             $voted = true;
         }
         $photos = [];
         if ($profile->photo1 != '') {
             $photos[] = $profile->photo1;
         }
         if ($profile->photo2 != '') {
             $photos[] = $profile->photo2;
         }
         if ($profile->photo3 != '') {
             $photos[] = $profile->photo3;
         }
         if ($profile->photo4 != '') {
             $photos[] = $profile->photo4;
         }
         if ($profile->photo5 != '') {
             $photos[] = $profile->photo5;
         }
         $fb = App::make('SammyK\\LaravelFacebookSdk\\LaravelFacebookSdk');
         $user = User::where('id', '=', $profile->user_id)->first();
         $data = array('selectedPage' => 1, 'profile' => $profile, 'user' => $user, 'fbLink' => $fb->getLoginUrl(['email']), 'votes' => $profile->votes()->where('isActive', '1')->paginate($this->pictures_lazy_load), 'total_votes' => $profile->votes()->where('isActive', '1')->count(), 'voted' => $voted, 'photos' => $photos, 'pageUrl' => env('BASE_FB_URL') . 'profile/index/' . $profile->id);
         return view('profile.index', $data);
     } else {
         echo 'profile not found';
     }
 }
Ejemplo n.º 30
-2
 /**
  * Controller Auto-Router
  *
  * @param string $controller eg. 'Admin\\UserController'
  * @param array $request_methods eg. array('get', 'post', 'put', 'delete')
  * @param string $prefix eg. admin.users
  * @param array $disallowed eg. array('private_method that starts with one of request methods)
  * @return Closure
  */
 public static function autoRoute($controller, $request_methods, $disallowed = array(), $prefix = '')
 {
     return function () use($controller, $prefix, $disallowed, $request_methods) {
         //get all defined functions
         $methods = get_class_methods(App::make($controller));
         //laravel methods to disallow by default
         $disallowed_methods = array('getBeforeFilters', 'getAfterFilters', 'getFilterer');
         //build list of functions to not allow
         if (is_array($disallowed)) {
             $disallowed_methods = array_merge($disallowed_methods, $disallowed);
         }
         //if there is a index method then lets just bind it and fill the gap in route_names
         if (in_array('getIndex', $methods)) {
             Lara::fillRouteGaps($prefix, $controller . '@getIndex');
         }
         //over all request methods, get, post, etc
         foreach ($request_methods as $type) {
             //filter functions that starts with request method and not in disallowed list
             $actions = array_filter($methods, function ($action) use($type, $disallowed_methods) {
                 return Str::startsWith($action, $type) && !in_array($action, $disallowed_methods);
             });
             foreach ($actions as $action) {
                 $controller_route = $controller . '@' . $action;
                 // Admin\\Controller@get_login
                 $url = Str::snake(str_replace($type, '', $action));
                 // login; snake_case
                 //double check and dont bind to already bound gaps filled index
                 if (in_array($action, $methods) && $action !== 'getIndex') {
                     $route = str_replace('..', '.', $prefix . '.' . Str::snake($action));
                     Route::$type($url, array('as' => $route, 'uses' => $controller_route));
                 }
             }
         }
     };
 }