/** * @param bool $asArray * @return array|static **/ public function getStoredUrls($asArray = false) { $keys = $this->lookups->keys(); if ($asArray) { return $keys->toArray(); } else { return $keys; } }
/** * Ask the user what they would like to register with the application * * @return void */ public function whatWouldYouLikeToRegister() { $choices = $this->registrars->keys(); $choices[] = 'No more'; $registerType = $this->askWithCompletion('What would you like to register? (' . implode(', ', $choices->toArray()) . ')', $choices->toArray(), $choices->first()); if ($registerType === 'No more') { foreach ($this->registrars as $registrar) { $registrar->afterRegistration(); } $this->updateEnvFile(); return; } if ($registerType == '' || !$this->registrars->has($registerType)) { $this->error('Unable to register that. Please try again.'); $this->whatWouldYouLikeToRegister(); return; } $this->registrars->get($registerType)->register(); $this->whatWouldYouLikeToRegister(); }
/** * Execute the command. * * @return void */ public function handle() { // New permissions $permissions = new Collection(); // Remove not existing permissions Permission::whereNotIn('resource', $this->routes->keys()->toArray())->delete(); foreach ($this->routes as $route) { // Do we have the current permission in the database. If so skip it... $existing_permission = Permission::where('resource', '=', $route['resource'])->first(); if ($existing_permission) { continue; } // Skip some methods $data = $this->getPermissionData($route); if ($data['method'] == 'missingMethod') { continue; } // Add new permission $permissions->push(Permission::create($data)); } $this->assignPermissions($permissions); }
public static function serialize(Collection &$cards, $attr = false) { $ary = []; foreach ($cards->keys() as $key) { $ary[$key] = $cards->get($key)->map(function ($item, $key) use($attr) { switch ($attr) { case true: return $item->toJSON(); case false: return $item->getAttribute($item->getKeyName()); default: //TODO: Complete attribute selection $attributes = collect($item->getAttributes()); return 'TODO'; } })->toArray(); } $cards = json_encode($ary); }
public function testKeys() { $c = new Collection(['name' => 'taylor', 'framework' => 'laravel']); $this->assertEquals(['name', 'framework'], $c->keys()->all()); }
/** * Get a new Eloquent Builder instance without any of the tenant scopes applied. * * @param Model $model * * @return \Illuminate\Database\Eloquent\Builder */ public function newQueryWithoutTenants(Model $model) { return $model->newQuery()->withoutGlobalScopes($this->tenants->keys()->toArray()); }
/** * Runs the given commands and paases them all the given parameters. * * @param Collection $commands * @param array $parameters * * @return void */ private function runCommandsWithParameters(Collection $commands, array $parameters) { $commands->keys()->each(function ($command) use($parameters) { $this->call($command, $parameters); }); }
/** * @return array */ public function getKeys() { return $this->fields->keys()->all(); }