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


PHP Str::snake方法代码示例

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


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

示例1: traitEntityItemDelete

 function traitEntityItemDelete()
 {
     $this->traitEntity_assertReason($this->model, 'delete');
     $data = ['vendor' => (string) static::getVendor(), 'entity' => \Str::snake($this->getEntity())];
     if ($this->model->deleted_at) {
         //            $this->model->restore();
         //            dd();
         $data['state'] = -1;
         $data['message'] = static::translateAction('item|delete.success.hard', ['model' => $this->model]);
         $data['models'][] = ['id' => $this->model->id];
         $this->model->forceDelete();
     } else {
         $this->model->delete();
         $data['state'] = 0;
         $data['message'] = static::translateAction('item|delete.success.soft', ['model' => $this->model]);
         $row_types = ManagerRowType::get(ManagerRowType::makeKey(static::getVendor(), static::getEntity()));
         $rows = [];
         foreach ($row_types as $row_type) {
             $rows[$row_type] = (string) Accessor::factory($this->model)->row($row_type);
         }
         $data['models'][] = ['id' => $this->model->id, 'model' => $this->model->toArray(), 'rows' => $rows];
     }
     $this->traitAjax_set($data);
     Event::notify('larakit::model_delete-admin', $data);
     return $this->traitAjax_response();
 }
开发者ID:larakit,项目名称:lk,代码行数:26,代码来源:TraitControllerEntityItemDelete.php

示例2: getTable

 /**
  * Get the @class (Class Name) associated with the model.
  *
  * @return string
  */
 public function getTable()
 {
     if (isset($this->table)) {
         return $this->table;
     }
     return str_replace('\\', '', Str::snake(Str::plural(class_basename($this))));
 }
开发者ID:lequocnam,项目名称:orient-laravel,代码行数:12,代码来源:Model.php

示例3: fire

 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     if (parent::fire() !== false) {
         if ($this->option('migration')) {
             $table = Str::plural(Str::snake(class_basename($this->argument('name'))));
             $this->call('make:rethink-migration', ['name' => "create_{$table}_table", '--create' => $table]);
         }
     }
 }
开发者ID:errietta,项目名称:laravel-rethinkdb,代码行数:14,代码来源:ModelMakeCommand.php

示例4: __construct

 public function __construct()
 {
     $class = get_class($this);
     $this->name = \Str::snake($class);
     $this->key = str_replace('_plugin', '', $this->name);
     $this->config = $this->loadConfig();
     if (!bool(element('enabled', $this->config, true))) {
         throw new \InvalidEntryException();
     }
 }
开发者ID:a11enwong,项目名称:pochika,代码行数:10,代码来源:Plugin.php

示例5: makeModelClass

 static function makeModelClass($vendor, $entity)
 {
     $class = $vendor;
     $data = explode('\\', $class);
     $count = substr_count($class, '\\');
     if ($count >= 3) {
         $class = \Str::snake(Arr::get($data, 0) . Arr::get($data, 1), '-');
     } else {
         $class = \Str::snake(Arr::get($data, 0));
     }
     return \Str::studly($class) . '\\Model\\' . \Str::studly($entity);
 }
开发者ID:larakit,项目名称:lk,代码行数:12,代码来源:TraitEntity.php

示例6: traitEntityRestore

 function traitEntityRestore()
 {
     $this->traitEntity_assertReason($this->model, 'restore');
     $this->model->restore();
     $row_types = ManagerRowType::get(ManagerRowType::makeKey(static::getVendor(), static::getEntity()));
     $rows = [];
     foreach ($row_types as $row_type) {
         $rows[$row_type] = (string) Accessor::factory($this->model)->row($row_type);
     }
     $data = ['models' => [['model' => $this->model->toArray(), 'rows' => $rows, 'id' => $this->model->id]], 'vendor' => (string) static::getVendor(), 'entity' => \Str::snake($this->getEntity()), 'message' => sprintf($this->traitEntityItemRestore_success(), $this->model), 'state' => 1];
     Event::notify('larakit::model_restore-admin', $data);
     $this->traitAjax_set($data);
     return $this->traitAjax_response();
 }
开发者ID:larakit,项目名称:lk,代码行数:14,代码来源:TraitControllerEntityItemRestore.php

示例7: deleteConfig

 /**
  * Remove a site from the config.
  *
  * @param $site
  *
  * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
  */
 public function deleteConfig($site)
 {
     // Convert yaml to array
     $config = $this->getConfig();
     // Look for the site in sites and in databases
     foreach ($config['sites'] as $key => $homesteadSite) {
         if ($homesteadSite['map'] == $site->name) {
             unset($config['sites'][$key]);
         }
     }
     foreach ($config['databases'] as $key => $homesteadDatabase) {
         if ($homesteadDatabase == Str::snake(str_replace('.app', '', $site->name))) {
             unset($config['databases'][$key]);
         }
     }
     // Rebuild the yaml
     $this->saveConfig($config);
 }
开发者ID:NukaCode,项目名称:dasher,代码行数:25,代码来源:Homestead.php

示例8: __construct

 /**
  * @var \Eloquent
  */
 function __construct()
 {
     $class = new \ReflectionClass(get_called_class());
     $methods = $class->getMethods();
     foreach ($methods as $method) {
         $name = $method->getName();
         if ('rule' == mb_substr($name, 0, 4)) {
             $rule = [];
             $rule[] = static::getVendor();
             $rule[] = static::getEntity();
             $rule[] = \Str::snake(mb_substr($name, 4));
             $ext = [];
             $ext[] = $class->getName();
             $ext[] = $name;
             $rule = implode('_', $rule);
             $ext = implode('@', $ext);
             \Validator::extend($rule, $ext);
         }
     }
 }
开发者ID:larakit,项目名称:lk,代码行数:23,代码来源:DataValidator.php

示例9: function

<?php

Route::pattern('idu', '[0-9]+');
Route::group(array('before' => 'basicAuth', 'prefix' => Config::get('backend.uri') . '/' . Config::get('backend.group_advertiser_manager_url')), function () {
    $prefixName = Str::studly(pathinfo(__DIR__, PATHINFO_BASENAME));
    $prefixSlug = Str::snake($prefixName, '-');
    Route::get('/tool', array('as' => $prefixName . 'ShowTool', 'uses' => $prefixName . 'Controller@tool'));
    Route::post('/tool/search', array('uses' => $prefixName . 'Controller@getListSelect'));
    //profile publisher
    Route::get('/tool/profile', array('before' => 'hasPermissions:' . $prefixSlug . '-edit', 'as' => $prefixName . 'Profile', 'uses' => $prefixName . 'Controller@myProfile'));
    Route::post('/tool/profile', array('before' => 'hasPermissions:' . $prefixSlug . '-edit', 'as' => $prefixName . 'Profile', 'uses' => $prefixName . 'Controller@myProfile'));
    Route::post('/tool/get-list', array('as' => $prefixName . 'GetList', 'uses' => $prefixName . 'Controller@getList'));
    Route::post('/tool/get-user', array('as' => $prefixName . 'GetUser', 'uses' => $prefixName . 'Controller@getUserId'));
    Route::get('/tool/user-manager', array('before' => 'hasPermissions:' . $prefixSlug . '-edit', 'as' => $prefixName . 'UserManager', 'uses' => $prefixName . 'Controller@userManager'));
    Route::get('/tool/list-publisher', array('before' => 'hasPermissions:' . $prefixSlug . '-read', 'as' => $prefixName . 'ShowListPublisher', 'uses' => $prefixName . 'Controller@showListPublisher'));
    Route::post('/tool/get-list-publisher', array('as' => $prefixName . 'GetListPublisher', 'uses' => $prefixName . 'Controller@getListPublisherManager'));
    Route::get('/tool/user-edit/{idu}', array('as' => $prefixName . 'ShowUpdate', 'uses' => $prefixName . 'Controller@myProfile'));
    Route::post('/tool/user-edit/{idu}', array('as' => $prefixName . 'ShowUpdate', 'uses' => $prefixName . 'Controller@myProfile'));
    Route::post('/tool/sort-flight-running', array('before' => 'hasPermissions:' . $prefixSlug . '-edit', 'as' => $prefixName . 'SortFlightRunning', 'uses' => $prefixName . 'Controller@sortFlightRunning'));
    Route::post('/tool/update-sort-flight-running', array('before' => 'hasPermissions:' . $prefixSlug . '-edit', 'as' => $prefixName . 'UpdateSortFlightRunning', 'uses' => $prefixName . 'Controller@postSortFlightRunning'));
    Route::post('/tool/preview', array('as' => $prefixName . 'Preview', 'uses' => $prefixName . 'Controller@preview'));
    Route::get('/tool/dashboard', array('as' => $prefixName . 'Preview', 'uses' => $prefixName . 'Controller@getDashboard'));
    Route::post('/tool/dashboard/campaign', array('as' => $prefixName . 'PreviewCampaign', 'uses' => $prefixName . 'Controller@getDashboardCampaign'));
    Route::post('/tool/dashboard/flightwebsite', array('as' => $prefixName . 'PreviewFlightWebsite', 'uses' => $prefixName . 'Controller@getDashboardFilghtWebsite'));
    Route::get('/tool/create-new-url-track', array('as' => $prefixName . 'CreateNew', 'uses' => $prefixName . 'Controller@createNewTrackURL'));
    Route::post('/tool/create-new-url-track', array('as' => $prefixName . 'CreateNew', 'uses' => $prefixName . 'Controller@createNewTrackURl'));
    Route::get('/tool/url-track-ga', array('as' => $prefixName . 'URLTrackGA', 'uses' => $prefixName . 'Controller@getUrlTrackGA'));
    Route::get('/tool/edit-url-track/{id}', array('as' => $prefixName . 'Edit', 'uses' => $prefixName . 'Controller@editTrackURL'));
    Route::post('/tool/edit-url-track/{id}', array('as' => $prefixName . 'Edit', 'uses' => $prefixName . 'Controller@editTrackURL'));
    Route::get('/tool/detail-url-track/{id}', array('as' => $prefixName . 'DetailUrlTrack', 'uses' => $prefixName . 'Controller@detailTrackURL'));
    Route::post('/tool/delete-url-track', array('as' => $prefixName . 'Delete', 'uses' => $prefixName . 'Controller@deleteTrackURL'));
开发者ID:huycao,项目名称:yoplatform,代码行数:31,代码来源:routes.php

示例10: getColumns

 /**
  * get model table columns
  *
  * @return mixed
  */
 protected function getColumns()
 {
     static $columns = [];
     if (!isset($columns[$this->modelClass])) {
         // if implemented "getAvailableFields"
         $callable = [$this->modelClass, 'getAvailableFields'];
         if (is_callable($callable)) {
             $columns[$this->modelClass] = call_user_func($callable);
         } else {
             /** @var \Illuminate\Database\Connection $connection */
             $connection = $this->_query()->getQuery()->getConnection();
             $columns[$this->modelClass] = $connection->getSchemaBuilder()->getColumnListing(str_replace('\\', '', Str::snake(Str::plural(class_basename($this->modelClass)))));
         }
     }
     return $columns[$this->modelClass];
 }
开发者ID:vampirekiss,项目名称:lumen-restful-starter-kit,代码行数:21,代码来源:ModelRepository.php

示例11: snake_case

 /**
  * Convert a string to snake case.
  *
  * @param  string  $value
  * @param  string  $delimiter
  * @return string
  */
 function snake_case($value, $delimiter = '_')
 {
     return Str::snake($value, $delimiter);
 }
开发者ID:runningjack,项目名称:busticketAPI1,代码行数:11,代码来源:helpers.php

示例12: traitEntityHasMany_item

 function traitEntityHasMany_item()
 {
     if (\Request::method() == 'POST') {
         $this->traitEntityHasMany_save();
         //переоткроем модель
         $model_name = $this->getClassModel();
         if ($model_name::isSoftDelete()) {
             $model = $model_name::withTrashed()->with($this->relation)->find(\Route::input('id'));
         } else {
             $model = $model_name::with($this->relation)->find(\Route::input('id'));
         }
         $row_types = ManagerRowType::get(ManagerRowType::makeKey(static::getVendor(), static::getEntity()));
         $rows = [];
         foreach ($row_types as $row_type) {
             $rows[$row_type] = (string) Accessor::factory($model)->row($row_type);
         }
         $data = ['models' => [['rows' => $rows, 'model' => $model->toArray(), 'id' => $model->id]], 'vendor' => (string) static::getVendor(), 'entity' => \Str::snake(static::getEntity()), 'message' => sprintf($this->traitEntityHasMany_successMessage(), $model)];
         Event::notify('larakit::model_edit-admin', $data);
         $this->traitAjax_set($data);
         return $this->traitAjax_response();
     }
     $this->traitAjax_set('id', $this->model->id)->traitAjax_set('result', 'curtain')->traitAjax_set('vendor', (string) \Str::snake($this->getVendor()))->traitAjax_set('entity', (string) \Str::snake($this->getEntity()))->traitAjax_set('model', $this->model->toArray())->traitAjax_set('header', (string) $this->traitEntityHasMany_header())->traitAjax_set('body', (string) $this->traitEntityHasMany_body())->traitAjax_set('footer', (string) $this->traitEntityHasMany_footer());
     return $this->traitAjax_response();
 }
开发者ID:larakit,项目名称:lk,代码行数:24,代码来源:TraitControllerEntityItemHasMany.php

示例13: traitEntityAddJson

 function traitEntityAddJson()
 {
     $this->traitAjax_set('id', $this->model->id)->traitAjax_set('result', 'curtain')->traitAjax_set('vendor', (string) static::getVendor())->traitAjax_set('entity', (string) \Str::snake($this->getEntity()))->traitAjax_set('model', $this->model->toArray())->traitAjax_set('header', (string) $this->traitEntityAdd_header())->traitAjax_set('body', (string) $this->traitEntityAdd_body())->traitAjax_set('footer', (string) $this->traitEntityAdd_footer());
     return $this->traitAjax_response();
 }
开发者ID:larakit,项目名称:lk,代码行数:5,代码来源:TraitControllerEntityAdd.php

示例14: getTable

 /**
  * Get the table associated with the model.
  *
  * @return string
  */
 public function getTable()
 {
     $table = \Config::get('auditing.table');
     if (isset($table)) {
         return $table;
     }
     return str_replace('\\', '', Str::snake(Str::plural(class_basename($this))));
 }
开发者ID:roketin,项目名称:laravel-auditing,代码行数:13,代码来源:Log.php

示例15: deNormalizeController

 /**
  * @param \Controller $class_name
  *
  * @return array
  */
 protected static function deNormalizeController($class_name)
 {
     preg_match('|^([A-Za-z\\\\]+)Controller\\\\([A-Za-z\\\\]+)Controller([A-Za-z]+)$|Umsi', $class_name, $matches);
     $vendor = trim(Arr::get($matches, 1, ''), '\\');
     $section = trim(Arr::get($matches, 2, ''), '\\');
     $entity = mb_substr(Arr::get($matches, 3), mb_strlen($section));
     if (method_exists($class_name, 'getEntitySuffix')) {
         $suffix = \Str::studly($class_name::getEntitySuffix());
         if ($suffix) {
             $entity = mb_substr($entity, 0, 0 - mb_strlen($suffix));
         }
     }
     return ['vendor' => str_replace('\\', '', \Str::snake($vendor, '-')), 'entity' => \Str::snake($entity), 'section' => \Str::snake($section), 'route_prefix' => \Str::snake($section)];
 }
开发者ID:larakit,项目名称:lk,代码行数:19,代码来源:HelperEntity.php


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