本文整理汇总了PHP中Illuminate\Support\Str::studly方法的典型用法代码示例。如果您正苦于以下问题:PHP Str::studly方法的具体用法?PHP Str::studly怎么用?PHP Str::studly使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Str
的用法示例。
在下文中一共展示了Str::studly方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
public function get($type = null)
{
if ($type) {
return $this->{"get" . Str::studly("{$type}-template")}();
}
$template = false;
if ($this->env->is_404() && ($template = $this->get('404'))) {
} elseif ($this->env->is_search() && ($template = $this->get('search'))) {
} elseif ($this->env->is_front_page() && ($template = $this->get('front-page'))) {
} elseif ($this->env->is_home() && ($template = $this->get('home'))) {
} elseif ($this->env->is_post_type_archive() && ($template = $this->get('post-type-archive'))) {
} elseif ($this->env->is_tax() && ($template = $this->get('taxonomy'))) {
} elseif ($this->env->is_attachment() && ($template = $this->get('attachment'))) {
} elseif ($this->env->is_single() && ($template = $this->get('single'))) {
} elseif ($this->env->is_page() && ($template = $this->get('page'))) {
} elseif ($this->env->is_singular() && ($template = $this->get('singular'))) {
} elseif ($this->env->is_category() && ($template = $this->get('category'))) {
} elseif ($this->env->is_tag() && ($template = $this->get('tag'))) {
} elseif ($this->env->is_author() && ($template = $this->get('author'))) {
} elseif ($this->env->is_date() && ($template = $this->get('date'))) {
} elseif ($this->env->is_archive() && ($template = $this->get('archive'))) {
} elseif ($this->env->is_comments_popup() && ($template = $this->get('comments-popup'))) {
} elseif ($this->env->is_paged() && ($template = $this->get('paged'))) {
} else {
$template = $this->getIndexTemplate();
}
return $template;
}
示例2: getMigrationStub
/**
* Get the contents of the migration stub.
*
* @return string
*/
protected function getMigrationStub()
{
$stub = file_get_contents(__DIR__ . '/../Stubs/MetableMigration.stub.php');
$stub = str_replace('{{table}}', $this->argument('table'), $stub);
$stub = str_replace('{{class}}', 'Create' . Str::studly($this->argument('table')) . 'Table', $stub);
return $stub;
}
示例3: make
/**
* Establish a PDO connection based on the configuration.
*
* @param array $config
* @param string $driver
*
* @return \Illuminate\Database\Connection
*/
public function make($driver, array $config = [])
{
if (method_exists($this, $method = "make" . Str::studly($driver) . "Connection")) {
return $this->{$method}($config);
}
throw new InvalidArgumentException("Unsupported connection [{$driver}]");
}
示例4: getMigrationStub
/**
* Get the contents of the customer migration stub.
*
* @return string
*/
protected function getMigrationStub()
{
$stub = file_get_contents(__DIR__ . '/../DorellJames/Billing/Stubs/CustomerMigration.stub');
$stub = str_replace('customer_table', $this->argument('table'), $stub);
$stub = str_replace('AddCustomerBillingColumnsTo', 'AddCustomerBillingColumnsTo' . Str::studly($this->argument('table')), $stub);
return $stub;
}
示例5: logs
public function logs()
{
$model_id = Str::studly($this->getTable());
$data_id = $this->id;
$logs = Activitylog::where('model_id', $model_id)->where('data_id', $data_id)->orderBy('id', 'desc')->get();
return $logs->toArray();
}
示例6: __construct
/**
* TwoSelectBox constructor.
*
* @param $name
* @param $type
* @param Form $parent
* @param array $options
*/
public function __construct($name, $type, Form $parent, array $options)
{
$options['attr']['extend'] = true;
$options['attr']['multiple'] = true;
$options['btnSelect'] = array_merge(['class' => 'btn', 'id' => 'btnSelect'], isset($options['btnSelect']) ? $options['btnSelect'] : []);
$options['btnUnSelect'] = array_merge(['class' => 'btn', 'id' => 'btnUnSelect'], isset($options['btnUnSelect']) ? $options['btnUnSelect'] : []);
$options['container_id'] = Str::studly(Str::slug($name, '_')) . "TwoSelectBoxContainer";
/** Load data from model */
/** @var Model $model */
$model = $options['model'];
$primary = $options['primary'];
$show = $options['show'];
/** Detect I18N */
$locale = \Config::get('app.locale');
$is_i18n = method_exists($model, 'saveI18N');
$query = $is_i18n ? $model::I18N($locale) : $model::query();
/** END **/
if (key_exists('filter', $options) && count($options['filter']) > 0) {
foreach ($options['filter'] as $key => $item) {
$query->where($key, $item['condition'], $item['value']);
}
}
/** Parse to key-name format {$table}.{$field} */
$keyName = strpos($options['primary'], '.') ? $options['primary'] : (new $model())->getTable() . "." . $options['primary'];
$data = $query->select($keyName, $show)->get()->toArray();
/** Fill model data to choice array */
$options['choices'] = array_pluck($data, $show, $primary);
/** END */
$options['selected'] = array_get($options, 'value', []);
/** END */
$options['selected'] = (array) (isset($options['selected']) ? $options['selected'] : []);
parent::__construct($name, $type, $parent, $options);
}
示例7: setAttribute
public function setAttribute($key, $value)
{
if ($this->hasCast($key) && method_exists($this, $method = 'set' . Str::studly($this->getCastType($key)) . 'Attribute')) {
return $this->{$method}($key, $value);
}
return parent::setAttribute($key, $value);
}
示例8: migrate
/**
* Run migrations for the specified module.
*
* @param string $slug
* @return mixed
*/
protected function migrate($slug)
{
$moduleName = Str::studly($slug);
if ($this->module->exists($slug)) {
$pretend = $this->option('pretend');
$path = $this->getMigrationPath($slug);
$this->migrator->run($path, $pretend);
// Once the migrator has run we will grab the note output and send it out to
// the console screen, since the migrator itself functions without having
// any instances of the OutputInterface contract passed into the class.
foreach ($this->migrator->getNotes() as $note) {
if (!$this->option('quiet')) {
$this->output->writeln($note);
}
}
// Finally, if the "seed" option has been given, we will re-run the database
// seed task to re-populate the database, which is convenient when adding
// a migration and a seed at the same time, as it is only this command.
if ($this->option('seed')) {
$this->call('module:seed', ['module' => $slug, '--force' => true]);
}
} else {
return $this->error("Module [{$moduleName}] does not exist.");
}
}
示例9: getMigrationStub
/**
* Get the contents of the subscription migration stub.
*
* @return string
*/
protected function getMigrationStub()
{
$stub = file_get_contents(__DIR__ . '/../Mmanos/Billing/Stubs/SubscriptionMigration.stub');
$stub = str_replace('subscription_table', $this->argument('table'), $stub);
$stub = str_replace('AddSubscriptionBillingColumnsTo', 'AddSubscriptionBillingColumnsTo' . Str::studly($this->argument('table')), $stub);
return $stub;
}
示例10: registerDirectives
private function registerDirectives()
{
Blade::directive('allowed', function ($expression) {
if (Str::startsWith($expression, '(')) {
$expression = substr($expression, 1, -1);
}
return "<?php if (app('rbac')->checkAccess(\\Auth::user(), {$expression})): ?>";
});
if (Config::get('rbac.shortDirectives')) {
foreach (Rbac::getRepository() as $name => $item) {
$directiveName = $item->type == Item::TYPE_PERMISSION ? 'allowed' : 'is';
$directiveName .= Str::studly(str_replace('.', ' ', $name));
Blade::directive($directiveName, function ($expression) use($name) {
$expression = trim($expression, '()');
if (!empty($expression)) {
$expression = ', ' . $expression;
}
return "<?php if (app('rbac')->checkAccess(\\Auth::user(), '{$name}'{$expression})): ?>";
});
}
}
Blade::directive('endallowed', function ($expression) {
return "<?php endif; ?>";
});
}
示例11: guessModel
public function guessModel()
{
$method = $this->guessRelatedMethod();
$modelName = Str::studly($method);
if ($method && Artificer::modelManager()->has($modelName)) {
return $modelName;
}
}
示例12: getPluralClassName
protected function getPluralClassName()
{
$classPlural = Str::studly($this->argument('resource-plural'));
if (is_null($classPlural) || empty($classPlural)) {
$classPlural = $this->getSingularClassName() . 's';
}
return $classPlural;
}
示例13: __call
/**
* "magic" caller method to simply instantiate field types.
*
* @param string $type
* @param array $arguments
*
* @access public
* @return BaseField
*/
public function __call($type, array $arguments)
{
$name = array_shift($arguments);
$type = sprintf('\\KraftHaus\\Bauhaus\\Field\\%sField', Str::studly($type));
$field = new $type($name, $this->getAdmin());
$this->fields[$name] = $field;
return $field;
}
示例14: dbseed
/**
* Seed the specified module.
*
* @parama string $name
* @return array
*/
protected function dbseed($name)
{
$params = ['--class' => $this->option('class') ? $this->option('class') : Str::studly($name) . 'DatabaseSeeder'];
if ($option = $this->option('database')) {
$params['--database'] = $option;
}
$this->call('db:seed', $params);
}
示例15: generateClassName
/**
* Generates a class name by combining the name with the suffix (i.e. Validation)
*
* @param string $name
*
* @return string
*
* @throws \Ricketson\Validation\NotFoundException
*/
protected function generateClassName($name)
{
$className = Str::studly($name . $this->config['class_suffix']);
if (!class_exists($className)) {
throw new NotFoundException(sprintf('The validation class "%s" does not exist.', $className));
}
return $className;
}