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


PHP Str::singular方法代码示例

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


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

示例1: get_delete

 public function get_delete($model = null, $id = null)
 {
     if (is_null($model) || is_null($id)) {
         return Redirect::to(Adminify\Libraries\Helpers::url('/'));
     }
     $this->layout->title = 'Delete Entry';
     $this->layout->nest('content', 'adminify::models.delete', array('model' => Str::singular($model), 'name' => $model));
 }
开发者ID:ashicus,项目名称:apocalypse,代码行数:8,代码来源:models.php

示例2: getModel

 public static function getModel($model)
 {
     $models = static::getModels();
     if (!in_array($model, $models)) {
         return false;
     }
     $model = Str::singular($model);
     return $model;
 }
开发者ID:ashicus,项目名称:apocalypse,代码行数:9,代码来源:helpers.php

示例3: resourceful

 /**
  * Generates resourceful routes.
  *
  * Assumes controller name is plural.
  *
  * @param  string  $name
  * @param  array   $include  actions to generate routes for
  * @return void
  */
 public static function resourceful($name, $include = array('index', 'new', 'create', 'show', 'edit', 'update', 'destroy'))
 {
     $plural = Str::plural($name);
     $singular = Str::singular($name);
     if (in_array('index', $include)) {
         Router::register("GET", "{$plural}", array("as" => $plural, "uses" => "{$plural}@index"));
     }
     if (in_array('new', $include)) {
         Router::register("GET", "{$plural}/new", array("as" => "new_{$plural}", "uses" => "{$plural}@new"));
     }
     if (in_array('create', $include)) {
         Router::register("POST", "{$plural}", array("as" => $plural, "uses" => "{$plural}@create"));
     }
     if (in_array('show', $include)) {
         Router::register("GET", "{$plural}/(:num)", array("as" => $singular, "uses" => "{$plural}@show"));
     }
     if (in_array('edit', $include)) {
         Router::register("GET", "{$plural}/(:num)/edit", array("as" => "edit_{$singular}", "uses" => "{$plural}@edit"));
     }
     if (in_array('update', $include)) {
         Router::register("PUT", "{$plural}/(:num)", array("as" => $singular, "uses" => "{$plural}@update"));
     }
     if (in_array('destroy', $include)) {
         Router::register("DELETE", "{$plural}/(:num)", array("as" => $singular, "uses" => "{$plural}@destroy"));
     }
     if (in_array('destroy', $include)) {
         Router::register("GET", "{$plural}/(:num)/destroy", array("as" => $singular . "_destroy", "uses" => "{$plural}@destroy"));
     }
 }
开发者ID:nenoraith,项目名称:sowcomposer,代码行数:38,代码来源:route.php


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