本文整理汇总了PHP中Collection::all方法的典型用法代码示例。如果您正苦于以下问题:PHP Collection::all方法的具体用法?PHP Collection::all怎么用?PHP Collection::all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Collection
的用法示例。
在下文中一共展示了Collection::all方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: all
/**
* Return array of HTTP header names and values.
* This method returns the _original_ header name
* as specified by the end user.
*
* @return array
*/
public function all()
{
$all = parent::all();
$out = [];
foreach ($all as $key => $props) {
$out[$props['originalKey']] = $props['value'];
}
return $out;
}
示例2: getHeaders
public function getHeaders()
{
$headers = array();
$parameters = $this->server->all();
foreach ($parameters as $key => $value) {
if (0 === strpos($key, 'HTTP_')) {
$headers[substr($key, 5)] = $value;
} elseif (in_array($key, array('CONTENT_LENGTH', 'CONTENT_MD5', 'CONTENT_TYPE'))) {
$headers[$key] = $value;
}
}
if (isset($this->parameters['PHP_AUTH_USER'])) {
$headers['PHP_AUTH_USER'] = $this->parameters['PHP_AUTH_USER'];
$headers['PHP_AUTH_PW'] = isset($this->parameters['PHP_AUTH_PW']) ? $this->parameters['PHP_AUTH_PW'] : '';
} else {
/*
* php-cgi under Apache does not pass HTTP Basic user/pass to PHP by default
* For this workaround to work, add this line to your .htaccess file:
* RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
*
* A sample .htaccess file:
* RewriteEngine On
* RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
* RewriteCond %{REQUEST_FILENAME} !-f
* RewriteRule ^(.*)$ app.php [QSA,L]
*/
$authorizationHeader = null;
if (isset($this->parameters['HTTP_AUTHORIZATION'])) {
$authorizationHeader = $this->parameters['HTTP_AUTHORIZATION'];
} elseif (isset($this->parameters['REDIRECT_HTTP_AUTHORIZATION'])) {
$authorizationHeader = $this->parameters['REDIRECT_HTTP_AUTHORIZATION'];
}
// Decode AUTHORIZATION header into PHP_AUTH_USER and PHP_AUTH_PW
if (null !== $authorizationHeader) {
$exploded = explode(':', base64_decode(substr($authorizationHeader, 6)));
if (count($exploded) == 2) {
list($headers['PHP_AUTH_USER'], $headers['PHP_AUTH_PW']) = $exploded;
}
}
}
// PHP_AUTH_USER/PHP_AUTH_PW
if (isset($headers['PHP_AUTH_USER'])) {
$headers['AUTHORIZATION'] = 'Basic ' . base64_encode($headers['PHP_AUTH_USER'] . ':' . $headers['PHP_AUTH_PW']);
}
return $headers;
}
示例3: __callStatic
public static function __callStatic($name, $arguments)
{
$collection = new Collection($arguments[0]);
switch ($name) {
case '_columns':
return $collection->columns($arguments[1]);
case '_where':
return $collection->where($arguments[1]);
case '_join':
return $collection->join($arguments[1]);
case '_order':
return $collection->order($arguments[1], $arguments[2]);
case '_group':
return $collection->group($arguments[1]);
case '_limit':
return $collection->limit($arguments[1]);
case '_offset':
return $collection->offset($arguments[1]);
case '_all':
return $collection->all();
default:
throw new \Bacon\Exceptions\MethodNotFound();
}
}
示例4: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$this->layout->content = View::make('collections.index')->with('collections', Collection::all());
}
示例5: function
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/
Route::get('/', function () {
$t = 1;
$inventories = Inventory::all();
return View::make('main/index')->with('inventories', $inventories)->with('t', $t);
});
Route::get('/albums', function () {
$albums = Collection::all();
return View::make('main/albums')->with('albums', $albums);
});
Route::get('/album/{albums}', function ($albums) {
$albums = Collection::find($albums);
return View::make('main/album')->with(array('albums' => $albums));
});
Route::get('/albums/{album}/image/{image}', function ($album, $image) {
$album = Collection::find($album);
$image = Inventory::find($image);
return View::make('main/image')->with(array('album' => $album, 'image' => $image));
});
Route::get('/login', function () {
return View::make('main/login');
});
//// ADMIN ROUTES BELOW
示例6: edit
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return Response
*/
public function edit($id)
{
$inventory = Inventory::find($id);
$this->layout->content = View::make('inventories.edit')->with('inventory', $inventory)->with('collections', Collection::all()->lists('name', 'id'));
}