/** * Execute the console command. * * @return void */ public function fire() { $clientName = $this->argument('name'); $clientId = $this->option('id'); $clientSecret = $this->option('secret'); if (empty($clientId)) { $clientId = Str::random(40); } if (empty($clientSecret)) { $clientSecret = Str::random(40); } $oAuthClient = OauthClient::create(array('id' => $clientId, 'secret' => $clientSecret, 'name' => $clientName)); if ($oAuthClient->exists) { $this->info('Client Name: ' . $clientName); $this->info('Client Id: ' . $clientId); $this->info('Client Secret: ' . $clientSecret); $this->info('Created'); } else { $this->error('Client Name: ' . $clientName); $this->error('Failed'); } }
/** * Create a new instance. * * @return void */ public function __construct() { //Set API base url if empty if (empty($this->apiBaseUrl)) { $this->apiBaseUrl = URL::to('/'); } //Set API url if empty if (empty($this->apiUrl)) { $this->apiUrl = $this->apiBaseUrl . '/api/' . $this->apiVersion; } //Get the webste OAuth Client credentials $oauthClient = OauthClient::where('name', '=', 'website')->first(); if (is_object($oauthClient)) { $this->clientId = $oauthClient->id; $this->clientSecret = $oauthClient->secret; } unset($oauthClient); Blade::extend(function ($view) { return preg_replace(array('#@translate\\(\\s*\\"([^"]+)\\"\\s*\\)#', "#@translate\\(\\s*\\'([^']+)\\'\\s*\\)#"), array('Translate::t("$1")', 'Translate::t(\'$1\')'), $view); }); Blade::extend(function ($view) { return preg_replace(array('#@option\\(\\s*\\"([^"]+)\\"\\s*\\)#', "#@option\\(\\s*\\'([^']+)\\'\\s*\\)#"), array('Option::getAttribute(\'$1\')', 'Option::getAttribute(\'$1\')'), $view); }); Blade::extend(function ($view) { return preg_replace(array('#@hasPermission\\(\\s*\\"([^"]+)\\"\\s*\\)#', "#@hasPermission\\(\\s*\\'([^']+)\\'\\s*\\)#"), array('Access::has(\'$1\')', 'Access::has(\'$1\')'), $view); }); $this->getAccessToken(); View::share('basePath', Request::getBaseURL()); }