当前位置: 首页>>代码示例>>PHP>>正文


PHP Str::studly方法代码示例

本文整理汇总了PHP中Str::studly方法的典型用法代码示例。如果您正苦于以下问题:PHP Str::studly方法的具体用法?PHP Str::studly怎么用?PHP Str::studly使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Str的用法示例。


在下文中一共展示了Str::studly方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: reason

 /**
  * Возвращает причину отказа на доступ
  * Если причин нет - возвращает false, что означает наличие доступа
  *
  * @param type $action
  *
  * @return boolean
  */
 function reason($action = 'manage')
 {
     $callback = [$this, 'reason' . \Str::studly($action)];
     if (is_callable($callback)) {
         return call_user_func($callback);
     }
     //по умолчанию разрешаем все!
     return false;
 }
开发者ID:larakit,项目名称:lk,代码行数:17,代码来源:Acl.php

示例2: add

 /**
  * @param      $name
  * @param null $container
  *
  * @return ElementTbText
  */
 function add($name, $container = null)
 {
     $method = \Str::studly('add_' . $name);
     if (!$container) {
         $container = $this->form;
     }
     $element = call_user_func([$this, $method], $container);
     /* @var ElementTbText $element */
     $element->toggleFrozen(!$this->isFieldEnabled($name));
     if (!$element->getLabel()) {
         $element->setLabel($this->model->getEntityLabel($name));
     }
     return $element;
 }
开发者ID:larakit,项目名称:lk,代码行数:20,代码来源:LaraFormBuilder.php

示例3: _validate

 protected function _validate($attribute, $rule)
 {
     list($rule, $parameters) = $this->_parseRule($rule);
     if ($rule == '') {
         return true;
     }
     $method = '_validate' . Str::studly($rule);
     $value = $this->_getValue($attribute);
     if (!$this->{$method}($attribute, $value, $parameters, $this)) {
         $this->_addFailure($attribute, $rule, $parameters);
         return false;
     }
     return true;
 }
开发者ID:seaice,项目名称:li-framework,代码行数:14,代码来源:Validator.php

示例4: getTemplate

 /**
  * Fetch the compiled template for a migration
  *
  * @param  string $template Path to template
  * @param  string $name
  * @return string Compiled template
  */
 protected function getTemplate($template, $name)
 {
     // We begin by fetching the master migration stub.
     $stub = $this->file->get(__DIR__ . '/templates/migration/migration.txt');
     // Next, set the migration class name
     $stub = str_replace('{{name}}', \Str::studly($name), $stub);
     // Now, we're going to handle the tricky
     // work of creating the Schema
     $upMethod = $this->getUpStub();
     $downMethod = $this->getDownStub();
     // Finally, replace the migration stub with the dynamic up and down methods
     $stub = str_replace('{{up}}', $upMethod, $stub);
     $stub = str_replace('{{down}}', $downMethod, $stub);
     return $stub;
 }
开发者ID:rosskmurphy,项目名称:Laravel-4-login-registration,代码行数:22,代码来源:MigrationGenerator.php

示例5: setAttribute

 /**
  * Set a given attribute on the model.
  *
  * @param  string  $key
  * @param  mixed   $value
  * @return void
  */
 public function setAttribute($key, $value)
 {
     // First we will check for the presence of a mutator for the set operation
     // which simply lets the developers tweak the attribute as it is set on
     // the model, such as "json_encoding" an listing of data for storage.
     if ($this->hasSetMutator($key)) {
         $method = 'set' . Str::studly($key) . 'Attribute';
         return $this->{$method}($value);
     } elseif (in_array($key, $this->getDates()) && $value) {
         $value = $this->fromDateTime($value);
     }
     if ($this->isArrayCastable($key) && !is_null($value)) {
         $value = self::arrayStringify($value);
     }
     if ($this->isJsonCastable($key) && !is_null($value)) {
         $value = json_encode($value);
     }
     $this->attributes[$key] = $value;
 }
开发者ID:haegemon,项目名称:lara-array,代码行数:26,代码来源:LaraArray.php

示例6: store

 public function store()
 {
     //make plural, title case
     $title = mb_convert_case(Str::plural(Input::get('title')), MB_CASE_TITLE, 'UTF-8');
     //determine table name, todo check if unique
     $name = Str::slug($title, '_');
     //model name
     $model = Str::singular(Str::studly($title));
     //enforce predence always ascending
     $order_by = Input::get('order_by');
     $direction = Input::get('direction');
     if ($order_by == 'precedence') {
         $direction = 'asc';
     }
     //create entry in objects table for new object
     $object_id = DB::table(DB_OBJECTS)->insertGetId(['title' => $title, 'name' => $name, 'model' => $model, 'order_by' => $order_by, 'direction' => $direction, 'list_grouping' => Input::get('list_grouping'), 'updated_at' => new DateTime(), 'updated_by' => Auth::user()->id]);
     //create title field for table by default
     DB::table(DB_FIELDS)->insert(['title' => 'Title', 'name' => 'title', 'type' => 'string', 'visibility' => 'list', 'required' => 1, 'object_id' => $object_id, 'updated_at' => new DateTime(), 'updated_by' => Auth::user()->id, 'precedence' => 1]);
     self::addTable($name, true);
     self::saveSchema();
     return Redirect::action('InstanceController@index', $name);
 }
开发者ID:joshreisner,项目名称:avalon,代码行数:22,代码来源:ObjectController.php

示例7: validate

 private function validate($attribute, $rule)
 {
     list($rule, $parameters) = $this->parseRule($rule);
     $value = $this->getValue($attribute);
     $method = 'validate' . Str::studly($rule);
     if ($rule != 'required' && $value === null) {
         return true;
     }
     if (!$this->{$method}($attribute, $value, $parameters)) {
         if (in_array($rule, ['min', 'max', 'contain', 'size'])) {
             $this->message = sprintf($this->validateMessages[$rule], $attribute, $parameters[0]);
         } elseif ($rule == 'between') {
             $this->message = sprintf($this->validateMessages[$rule], $attribute, $parameters[0], $parameters[1]);
         } elseif ($rule == 'in') {
             $this->message = sprintf($this->validateMessages[$rule], $attribute, implode(', ', $parameters));
         } else {
             $this->message = sprintf($this->validateMessages[$rule], $attribute);
         }
         return false;
     }
     return true;
 }
开发者ID:raframework,项目名称:ra,代码行数:22,代码来源:Validator.php

示例8: getFormFilterClass

 static function getFormFilterClass()
 {
     $object = self::getArgs(func_get_args());
     $entity = \Str::studly(self::getEntity($object));
     $vendor = self::vendorToStudly(self::getVendor($object));
     $section = \Str::studly(self::getSection($object));
     return $vendor . '\\FormFilter\\FormFilter' . $entity . $section;
 }
开发者ID:larakit,项目名称:lk,代码行数:8,代码来源:HelperEntity.php

示例9: revert

 /**
  * 
  * Revert data
  * @param $id
  */
 function revert($id)
 {
     $dataLog = LogsBaseModel::find($id);
     if ('update' == $dataLog->type_task && strlen($dataLog->pre_content) > 0) {
         $preContent = json_decode($dataLog->pre_content, true);
         $class = Str::studly($dataLog->module) . Str::studly(Request::segment(2)) . 'Model';
         $model = new $class();
         if ($model->where('id', $preContent['id'])->update($preContent)) {
             Session::flash('flash-message', 'Revert Success !');
         }
     }
     return Redirect::to($this->moduleURL . 'show-list');
 }
开发者ID:huycao,项目名称:yoplatform,代码行数:18,代码来源:BackendController.php

示例10: uploadAvatar

 public function uploadAvatar($avatar, $username)
 {
     $image = new Image();
     $results = $image->addImage(public_path('img/avatars/User'), $avatar, \Str::studly($username));
     return $results;
 }
开发者ID:nukacode,项目名称:users,代码行数:6,代码来源:UserRepository.php

示例11: add

 /**
  *
  * @param string $editorId
  * @param string $name
  * @param string $filter
  * @param string $package
  * @param string $type
  */
 public static function add($editorId, $name = NULL, $filter = NULL, $package = NULL, $type = self::TYPE_HTML)
 {
     self::$editors[$editorId] = ['name' => $name === NULL ? \Str::studly($editorId) : $name, 'type' => $type == self::TYPE_HTML ? self::TYPE_HTML : self::TYPE_CODE, 'filter' => empty($filter) ? $editorId : $filter, 'package' => $package === NULL ? $editorId : $package];
 }
开发者ID:BlueCatTAT,项目名称:kodicms-laravel,代码行数:12,代码来源:WYSIWYG.php

示例12: parseModel

 protected function parseModel(array $thumb_route)
 {
     $vendor = Arr::get($thumb_route, 'vendor');
     $package = Arr::get($thumb_route, 'package');
     $class = '\\' . \Str::studly(str_replace('-', '\\_', $vendor)) . '\\Model\\' . \Str::studly($package);
     if (!class_exists($class)) {
         return false;
     }
     return $class;
 }
开发者ID:larakit,项目名称:lk,代码行数:10,代码来源:Sync.php

示例13: transformPluralStudly

 /**
  * Creates a studly plural
  */
 public function transformPluralStudly($key, $value)
 {
     return array(Str::plural(Str::studly($key)), Str::plural(Str::studly($value)));
 }
开发者ID:codesleeve,项目名称:generator,代码行数:7,代码来源:Transform.php

示例14: getClassModel

 static function getClassModel()
 {
     return static::getStudlyVendor() . '\\Model\\' . \Str::studly(static::getEntity());
 }
开发者ID:larakit,项目名称:lk,代码行数:4,代码来源:TraitEntity.php

示例15: themeStyle

 /**
  * Get the user's css file for the laravel style method
  *
  */
 public function themeStyle()
 {
     return '/css/master3/users/' . \Str::studly($this->username) . '.css';
 }
开发者ID:nukacode,项目名称:users,代码行数:8,代码来源:UserPresenter.php


注:本文中的Str::studly方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。