當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。