本文整理汇总了PHP中Illuminate\Support\Str::title方法的典型用法代码示例。如果您正苦于以下问题:PHP Str::title方法的具体用法?PHP Str::title怎么用?PHP Str::title使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Str
的用法示例。
在下文中一共展示了Str::title方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bootAdministratorViewComposer
/**
* Register administrator view composers.
*/
protected function bootAdministratorViewComposer()
{
view()->composer('administrator.widgets.*', function (View $view) {
/** @var \Yajra\CMS\Themes\Repositories\Repository $themes */
$themes = $this->app['themes'];
$theme = $themes->current();
$positions = $theme->positions;
$data = [];
foreach ($positions as $position) {
$data[$position] = Str::title($position);
}
$view->with('widget_positions', $data);
$view->with('theme', $theme);
/** @var \Yajra\CMS\Repositories\Extension\Repository $extensions */
$extensions = $this->app['extensions'];
$widgets = $extensions->allWidgets()->filter(function ($extension) {
return $extension->enabled;
});
$view->with('extensions', $widgets);
});
view()->composer(['administrator.partials.permissions'], function (View $view) {
$view->with('permissions', Permission::orderBy('resource')->get());
});
view()->composer(['system.macro.image-browser'], function (View $view) {
$view->with('mediaDirectories', $this->getFileDirectories());
});
}
示例2: search
/**
* Search for physicians.
*
* @return JSON
*/
public function search(Request $request)
{
$physicians = null;
$searchDistance = $request->distance ? $request->distance : 0;
$coords = $this->getCoordinates($request);
$orderBy = $request->has('order_by') ? $request->order_by : 'distance';
$sort = $request->has('sort') ? $request->sort : 'asc';
$limit = $request->has('per_page') ? $request->per_page : '25';
// if we don't have a requested distance, we'll cycle through
// our fallback distances until we get at least 1 result;
// if we don't have anything by our max distance, we'll return 0.
if (!$request->has('distance')) {
while (!$physicians || $physicians->count() == 0) {
$searchDistance = $this->getNextDistance($searchDistance);
$physicians = Physician::withinDistance($coords['lat'], $coords['lon'], $searchDistance)->alias($request->alias_id)->name($request->q)->gender($request->gender);
if ($searchDistance == $this->maxDistance) {
break;
}
}
} else {
$physicians = Physician::withinDistance($coords['lat'], $coords['lon'], $searchDistance)->alias($request->alias_id)->name($request->q)->gender($request->gender);
}
$alias = Alias::find($request->alias_id);
$queryMeta = ['city' => Str::title(urldecode($request->city)), 'state' => mb_strtoupper($request->state), 'zip' => $request->zip ? $request->zip : $this->getZip($request->city, $request->state), 'alias' => $alias ? $alias->alias : null, 'alias_id' => $alias ? $alias->id : null, 'aggregate' => AggregateReporter::report($physicians, $request->alias_id), 'q' => $request->q, 'gender' => $request->gender, 'count' => $physicians ? $physicians->count() : 0, 'radius' => $searchDistance, 'order_by' => $request->order_by, 'sort' => $request->sort, 'center' => ['lat' => $coords['lat'], 'lon' => $coords['lon']]];
$physicians = $physicians->orderBy($orderBy, $sort)->paginate($limit)->appends($request->query());
return $this->response->withPaginator($physicians, new PhysicianTransformer(), null, $queryMeta);
}
示例3: emplist
/**
* Display a listing the employees.
*
* @return \Illuminate\Http\Response
*/
public function emplist()
{
$str = \Request()->getRequestUri();
$id = substr($str, strrpos($str, '/') + 1, strlen($str));
$params = array('View' => Str::title($id) . ' Employee List', 'Description' => 'Manage your <strong>' . Str::title($id) . '</strong> employee records here.');
return view('employees.list', compact($params));
}
示例4: select
protected function select($data, $show)
{
$select = [];
foreach ($data as $d) {
if (is_array($show)) {
$value = '';
foreach ($show as $show_key) {
$value .= Str::title($show_key) . ': ' . $d[$show_key];
if (end($show) != $show_key) {
$value .= ' | ';
}
}
} elseif (is_callable($show)) {
$value = $show($d);
} else {
$value = $d[$show];
}
$select[$d['id']] = $value;
}
if (Request::has($this->name)) {
$this->id = Request::get($this->name);
} else {
if (isset($this->value->id)) {
$this->id = $this->value->id;
} else {
$this->id = $this->value;
}
}
echo \Form::select($this->name, ['0' => Request::ajax() ? '(current)' : '(none)'] + $select, $this->id, $this->attributes);
}
示例5: send
/**
* Send the given notification.
*
* @param mixed $notifiable
* @param \Illuminate\Notifications\Notification $notification
* @return void
*/
public function send($notifiable, Notification $notification)
{
if (!$notifiable->routeNotificationFor('mail')) {
return;
}
$message = $notification->toMail($notifiable);
if ($message instanceof Mailable) {
return $message->send($this->mailer);
}
$this->mailer->send($message->view, $message->data(), function ($m) use($notifiable, $notification, $message) {
$recipients = empty($message->to) ? $notifiable->routeNotificationFor('mail') : $message->to;
if (!empty($message->from)) {
$m->from($message->from[0], isset($message->from[1]) ? $message->from[1] : null);
}
if (is_array($recipients)) {
$m->bcc($recipients);
} else {
$m->to($recipients);
}
$m->subject($message->subject ?: Str::title(Str::snake(class_basename($notification), ' ')));
foreach ($message->attachments as $attachment) {
$m->attach($attachment['file'], $attachment['options']);
}
foreach ($message->rawAttachments as $attachment) {
$m->attachData($attachment['data'], $attachment['name'], $attachment['options']);
}
});
}
示例6: generateIndex
private function generateIndex()
{
$templateData = $this->commandData->templatesHelper->getTemplate("index.blade", $this->viewsPath);
if ($this->commandData->useSearch) {
$searchLayout = $this->commandData->templatesHelper->getTemplate("search.blade", $this->viewsPath);
$templateData = str_replace('$SEARCH$', $searchLayout, $templateData);
$fieldTemplate = $this->commandData->templatesHelper->getTemplate("field.blade", $this->viewsPath);
$fieldsStr = "";
foreach ($this->commandData->inputFields as $field) {
$singleFieldStr = str_replace('$FIELD_NAME_TITLE$', Str::title(str_replace("_", " ", $field['fieldName'])), $fieldTemplate);
$singleFieldStr = str_replace('$FIELD_NAME$', $field['fieldName'], $singleFieldStr);
$fieldsStr .= "\n\n" . $singleFieldStr . "\n\n";
}
$templateData = str_replace('$FIELDS$', $fieldsStr, $templateData);
} else {
$templateData = str_replace('$SEARCH$', '', $templateData);
}
$templateData = $this->fillTemplate($templateData);
$fileName = "index.blade.php";
$headerFields = "";
foreach ($this->commandData->inputFields as $field) {
$headerFields .= "<th>" . Str::title(str_replace("_", " ", $field['fieldName'])) . "</th>\n\t\t\t";
}
$headerFields = trim($headerFields);
$templateData = str_replace('$FIELD_HEADERS$', $headerFields, $templateData);
$tableBodyFields = "";
foreach ($this->commandData->inputFields as $field) {
$tableBodyFields .= "<td>{!! \$" . $this->commandData->modelNameCamel . "->" . $field['fieldName'] . " !!}</td>\n\t\t\t\t\t";
}
$tableBodyFields = trim($tableBodyFields);
$templateData = str_replace('$FIELD_BODY$', $tableBodyFields, $templateData);
$path = $this->path . $fileName;
$this->commandData->fileHelper->writeFile($path, $templateData);
$this->commandData->commandObj->info("index.blade.php created");
}
示例7: compileSchema
private static function compileSchema()
{
$upSchema = "";
$downSchema = "";
$schema = "";
$newSchema = "";
$count = 1;
foreach (self::$schema as $name => $values) {
if (in_array($name, self::$ignore)) {
continue;
}
$upSchema .= "\n//\n// NOTE -- {$name}\n// --------------------------------------------------\n\n{$values['up']}";
$downSchema .= "\n{$values['down']}";
// }
$schema = "<?php\n\n//\n// NOTE Migration Created: " . date("Y-m-d H:i:s") . "\n// --------------------------------------------------\n\nuse Illuminate\\Database\\Schema\\Blueprint;\nuse Illuminate\\Database\\Migrations\\Migration;\n\nclass Create" . str_replace('_', '', Str::title($name)) . "Table extends Migration {\n//\n// NOTE - Make changes to the database.\n// --------------------------------------------------\n\npublic function up()\n{\n" . $upSchema . "\n" . self::$up . "\n}\n\n//\n// NOTE - Revert the changes to the database.\n// --------------------------------------------------\n\npublic function down()\n{\n" . $downSchema . "\n" . self::$down . "\n}\n}";
$date = new \DateTime($values['create']);
//$filename = date('Y_m_d_His') . "_create_" . $name . "_table.php";
$filename = $date->format('Y_m_d_His') . $count . "_create_" . $name . "_table.php";
file_put_contents(__DIR__ . "/../database/migrations/{$filename}", $schema);
$schema = "";
$upSchema = "";
$downSchema = "";
$count++;
}
return $schema;
}
示例8: path
/**
* Generate path from argument
*
* @param string $argument
* @return string
*/
public static function path($argument)
{
$directories = explode('/', $argument);
$directories = array_map(function ($dir) {
return Str::title($dir);
}, $directories);
return implode('/', $directories);
}
示例9: CKEDITORS
/**
* @return array
*/
public static function CKEDITORS()
{
$result = [];
foreach (['none', 'basic', 'standard', 'full', 'TinyMCE'] as $editor) {
$result[$editor] = Str::title($editor);
}
return $result;
}
示例10: statuses
public function statuses()
{
$allStatuses = [static::STATUS_DRAFT, static::STATUS_PUBLISHED, static::STATUS_REMOVED];
$captions = array_map(function ($item) {
return Str::title($item);
}, $allStatuses);
return array_combine($allStatuses, $captions);
}
示例11: make
public function make($tag, $name = '')
{
$role = new $this->class();
$role->tag = $tag;
$role->name = $name ?: Str::title($tag);
$role->save();
return $role;
}
示例12: make
public function make($tag, $name = '', $description = '')
{
$permission = new $this->class();
$permission->tag = $tag;
$permission->name = $name ?: Str::title($tag);
$permission->description = $description;
$permission->save();
return $permission;
}
示例13: slugList
/**
* Display nested categories of the article.
*
* @return \Illuminate\Support\HtmlString
*/
public function slugList()
{
$categories = explode('/', $this->alias());
$html = [];
foreach ($categories as $category) {
$html[] = new HtmlString('<span class="label label-info">' . e(Str::title($category)) . '</span> ');
}
return new HtmlString(implode('', $html));
}
示例14: buildMessage
/**
* Build the mail message.
*
* @param \Illuminate\Mail\Message $mailMessage
* @param mixed $notifiable
* @param \Illuminate\Notifications\Notification $notification
* @param \Illuminate\Notifications\Messages\MailMessage $message
* @return void
*/
protected function buildMessage($mailMessage, $notifiable, $notification, $message)
{
$this->addressMessage($mailMessage, $notifiable, $message);
$mailMessage->subject($message->subject ?: Str::title(Str::snake(class_basename($notification), ' ')));
$this->addAttachments($mailMessage, $message);
if (!is_null($message->priority)) {
$mailMessage->setPriority($message->priority);
}
}
示例15: send
/**
* Send the given notification.
*
* @param mixed $notifiable
* @param \Illuminate\Notifications\Notification $notification
* @return void
*/
public function send($notifiable, Notification $notification)
{
if (!$notifiable->routeNotificationFor('mail')) {
return;
}
$message = $notification->toMail($notifiable);
$this->mailer->send($message->view, $message->toArray(), function ($m) use($notifiable, $notification, $message) {
$m->to($notifiable->routeNotificationFor('mail'));
$m->subject($message->subject ?: Str::title(Str::snake(class_basename($notification), ' ')));
});
}