本文整理汇总了PHP中Laravel\Str类的典型用法代码示例。如果您正苦于以下问题:PHP Str类的具体用法?PHP Str怎么用?PHP Str使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Str类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sidebar
/**
* sidebar function
* Create sidebar
* @return string
* @author joharijumali
**/
public static function sidebar()
{
// $Menu = Header::navigationdata();
$flow = URI::segment(3) == 'step' ? true : false;
$navValue = array(array(Navigation::HEADER, Str::upper(Lang::line('admin.monitor')->get())), array(Lang::line('admin.dashboard')->get(), url('admin/home/dashboard'), false, false, null, 'tasks'), array(Navigation::HEADER, Str::upper(Lang::line('admin.sysmgmt')->get())), array(Lang::line('admin.configmanagement')->get(), url('admin/system/sysConfig'), false, false, null, 'chevron-right'), array(Lang::line('admin.datamanagement')->get(), url('admin/data/board'), false, false, null, 'chevron-right'), array(Lang::line('admin.pagemanagement')->get(), url('admin/modul/page'), false, false, null, 'chevron-right'), array(Lang::line('admin.flowmanagement')->get(), url('admin/modul/flow'), $flow, false, null, 'chevron-right'), array(Lang::line('admin.navsetup')->get(), url('admin/system/navigate'), false, false, null, 'chevron-right'), array(Lang::line('admin.log')->get(), url('admin/system/logger'), false, false, null, 'chevron-right'), array(Navigation::HEADER, Str::upper(Lang::line('admin.sysuser')->get())), array(Lang::line('admin.navuserlist')->get(), url('admin/user/list'), false, false, null, 'chevron-right'), array(Lang::line('admin.navuserrole')->get(), url('admin/user/role'), false, false, null, 'chevron-right'), array(Navigation::HEADER, Lang::line('global.logout')->get()), array(Lang::line('global.logout')->get(), url('admin/login/logout'), false, false, null, 'off'));
return Navigation::lists(Navigation::links($navValue));
}
示例2: opinionated
/**
* Register opinionated controllers
*
* @param array $controllers the controllers and config
* @param string $bundle the bundle where the controller can be found
* @param string $url_prefix a global url prefix
* @param string $route_type the type of the route (pages or api)
* @param array $parents
*/
public static function opinionated($controllers, $bundle, $url_prefix, $route_type, $parents = array())
{
if (!ends_with($url_prefix, '/')) {
$url_prefix .= '/';
}
foreach ($controllers as $controller => $options) {
list($types, $children) = $options;
foreach ($types as $type) {
list($method, $plural, $has_identity, $postfix) = static::$types[$type];
$segment = $controller;
$action = ($bundle ? $bundle . '::' : '') . implode('.', $parents) . (count($parents) > 0 ? '.' : '') . $segment . '@' . $type;
if ($plural) {
$segment = Str::plural($segment);
}
$prefixes = array_map(function ($parent) {
return $parent ? $parent . '/(:any)/' : '(:any)/';
}, $parents);
$prefix = implode('', $prefixes);
$route = $url_prefix . $prefix . $segment . ($has_identity ? '/(:any)' : '') . ($route_type == 'pages' && $postfix ? '/' . $postfix : '');
if ($route_type == 'pages') {
$method = '*';
}
Router::register($method, $route, $action);
}
$parents[] = $controller;
if (is_array($children)) {
static::opinionated($children, $bundle, $url_prefix, $route_type, $parents);
}
$parents = array();
}
}
示例3: getModel
public static function getModel($model)
{
$models = static::getModels();
if (!in_array($model, $models)) {
return false;
}
$model = Str::singular($model);
return $model;
}
示例4: runMigration
protected function runMigration($version, $migration, $method)
{
$file = $this->path() . $version . DS . $migration . '.php';
$this->log('Migrate ' . $migration . '...');
$class = 'FluxBB_Update_' . Str::classify($migration);
include_once $file;
$instance = new $class();
$instance->{$method}();
}
示例5: setData
public static function setData($input)
{
$Category = $input['id'] == NULL || !isset($input['id']) ? new Status() : Status::find($input['id']);
$Category->status_name = Str::title($input['data']);
$Category->status_desc = $input['description'];
$Category->save();
$action = $input['id'] == NULL || !isset($input['id']) ? 'Insert' : '<b>(' . $input['id'] . ')</b> Update';
Log::write('Data', 'Status <b>' . $input['data'] . '</b> ' . $action . ' by ' . Auth::user()->username);
}
示例6: stub
/**
* Get the stub migration with the proper class name.
*
* @param string $bundle
* @param string $migration
* @return string
*/
protected function stub($bundle, $migration)
{
$stub = File::get(Bundle::path('doctrine') . 'migration_stub' . EXT);
$prefix = Bundle::class_prefix($bundle);
// The class name is formatted simialrly to tasks and controllers,
// where the bundle name is prefixed to the class if it is not in
// the default "application" bundle.
$class = $prefix . Str::classify($migration);
return str_replace('{{class}}', $class, $stub);
}
示例7: id
/**
* Get a new session ID that isn't assigned to any current session.
*
* @return string
*/
public function id()
{
$session = array();
// We'll containue generating random IDs until we find an ID that is
// not currently assigned to a session. This is almost definitely
// going to happen on the first iteration.
do {
$session = $this->load($id = Str::random(40));
} while (!is_null($session));
return $id;
}
示例8: listData
public static function listData()
{
$allGroup = Group::paginate(Config::get('system.pagination'));
$datagrid = new Datagrid();
$datagrid->setFields(array('group_name' => Str::upper(Lang::line('admin.datagroup')->get())));
$datagrid->setAction(Lang::line('global.manage')->get(), 'datacontent', false);
$datagrid->setAction(Lang::line('global.edit')->get(), 'editGroup', true, array('dmid'));
$datagrid->setAction(Lang::line('global.delete')->get(), 'deleteGroup', true, array('dmid', 'group_name'));
$datagrid->setTable('dataGroup', 'table table-bordered table-hover table-striped table-condensed');
$datagrid->build($allGroup, 'dmid');
return $datagrid->render();
}
示例9: listRole
public static function listRole()
{
$rolelist = Role::paginate(Config::get('system.pagination'));
$datagrid = new Datagrid();
$datagrid->setFields(array('role' => Str::upper(Lang::line('admin.rolename')->get()), 'roledesc' => Str::upper(Lang::line('admin.roledesc')->get())));
$datagrid->setAction(Lang::line('global.edit')->get(), 'editRoleModal', true, array('roleid'));
//false,array('id'=>'roleid','data-toggle'=>'modal'));
$datagrid->setAction(Lang::line('global.delete')->get(), 'deleteRole', true, array('roleid'));
$datagrid->setContainer('list01', 'span12');
$datagrid->setTable('users', 'table table-bordered table-hover table-striped table-condensed');
$datagrid->build($rolelist, 'roleid');
return $datagrid->render();
}
示例10: generate
/**
* Generate a random key for the application.
*
* @param array $arguments
* @return void
*/
public function generate($arguments = array())
{
// By default the Crypter class uses AES-256 encryption which uses
// a 32 byte input vector, so that is the length of string we will
// generate for the application token unless another length is
// specified through the CLI.
$key = Str::random(array_get($arguments, 0, 32));
$config = File::get($this->path);
$config = str_replace("'key' => '',", "'key' => '{$key}',", $config, $count);
File::put($this->path, $config);
if ($count > 0) {
echo "Configuration updated with secure key!";
} else {
echo "An application key already exists!";
}
echo PHP_EOL;
}
示例11: get_edit
public function get_edit($model = null, $id = null)
{
$name = $model;
if (is_null($model) || is_null($id)) {
return Redirect::to(Adminify\Libraries\Helpers::url('/'));
}
$model = Helpers::getModel($model);
if (is_null($model)) {
return Redirect::to(Adminify\Libraries\Helpers::url('/'));
}
$entry = $model::find($id);
$table = property_exists($model, 'table') && !is_null($model::$table) ? $model::$table : strtolower(Str::plural($model));
$structure = DB::query("SHOW COLUMNS FROM `" . $table . "`");
$excluded = Helpers::getFields($model);
$this->layout->title = 'Edit ' . $model;
$this->layout->nest('content', 'adminify::models.edit', array('entry' => $entry, 'model' => $model, 'name' => $name, 'structure' => $structure, 'excluded' => $excluded));
}
示例12: id
/**
* Get a new session ID that isn't assigned to any current session.
*
* @return string
*/
public function id()
{
$session = array();
// If the driver is an instance of the Cookie driver, we are able to
// just return any string since the Cookie driver has no real idea
// of a server side persisted session with an ID.
if ($this instanceof Cookie) {
return Str::random(40);
}
// We'll continue generating random IDs until we find an ID that is
// not currently assigned to a session. This is almost definitely
// going to happen on the first iteration.
do {
$session = $this->load($id = Str::random(40));
} while (!is_null($session));
return $id;
}
示例13: userSearchList
public static function userSearchList($input)
{
$operator = stripos($input['searchval'], '*') ? 'LIKE' : '=';
$val = str_replace("*", "", $input['searchval']);
$refval = stripos($input['searchval'], '*') ? '%' . $val . '%' : $val;
$allUser = User::left_join('users_profiles', 'users.userid', '=', 'users_profiles.userid')->where('icno', $operator, $refval)->or_where('fullname', $operator, $refval)->paginate(Config::get('system.pagination'));
$datagrid = new Datagrid();
$datagrid->setFields(array('userprofile/fullname' => Str::upper(Str::title(Lang::line('admin.fullname')->get()))));
$datagrid->setFields(array('userprofile/emel' => Str::upper(Str::title(Lang::line('admin.activeemel')->get()))));
$datagrid->setFields(array('userprofile/icno' => Str::upper(Str::title(Lang::line('admin.idno')->get()))));
$datagrid->setFields(array('status' => Str::upper('Status')));
$datagrid->setAction(Lang::line('global.edit')->get(), 'viewUser', true, array('userid'));
$datagrid->setAction(Lang::line('global.delete')->get(), 'deleteAccount', true, array('userid'));
$datagrid->setAction(Lang::line('global.reset')->get(), 'resetAccount', true, array('userid'));
$datagrid->setTable('users', 'table table-bordered table-hover table-striped table-condensed');
$datagrid->build($allUser, 'userid');
return $datagrid->render();
}
示例14: load
/**
* Load the session for the current request.
*
* @param string $id
* @return void
*/
public function load($id)
{
if (!is_null($id)) {
$this->session = $this->driver->load($id);
}
// If the session doesn't exist or is invalid we will create a new session
// array and mark the session as being non-existent. Some drivers, such as
// the database driver, need to know whether it exists.
if (is_null($this->session) or static::expired($this->session)) {
$this->exists = false;
$this->session = $this->driver->fresh();
}
// A CSRF token is stored in every session. The token is used by the Form
// class and the "csrf" filter to protect the application from cross-site
// request forgery attacks. The token is simply a random string.
if (!$this->has(Session::csrf_token)) {
$this->put(Session::csrf_token, Str::random(40));
}
}
示例15: genListData
/**
* Generate Data datagrid table
*
* @return void
* @author
**/
public static function genListData()
{
$allContent = Content::paginate(Config::get('system.pagination'));
$datagrid = new Datagrid();
$tableCol = DB::query('show columns from ' . Content::$table);
foreach ($tableCol as $value) {
if ($value->field != 'created_at' && $value->field != 'updated_at' && $value->field != Content::$key) {
if (stristr($value->field, 'name')) {
$title = Str::upper(Lang::line('global.data')->get());
} elseif (stristr($value->field, 'desc')) {
$title = Str::upper(Lang::line('global.desc')->get());
} else {
$title = $value->field;
}
$datagrid->setFields(array($value->field => $title));
}
}
$datagrid->setAction(Lang::line('global.edit')->get(), 'editData', true, array(Content::$key));
$datagrid->setAction(Lang::line('global.delete')->get(), 'deleteData', true, array(Content::$key));
$datagrid->setTable('contentGroup', 'table table-bordered table-hover table-striped table-condensed');
$datagrid->build($allContent, Content::$key);
return $datagrid->render();
}