本文整理汇总了PHP中Album::with方法的典型用法代码示例。如果您正苦于以下问题:PHP Album::with方法的具体用法?PHP Album::with怎么用?PHP Album::with使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Album
的用法示例。
在下文中一共展示了Album::with方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
|--------------------------------------------------------------------------
|
| 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('/', array('uses' => 'HomeController@hello', 'as' => 'home'));
Route::get('/', array('uses' => 'LoginController@index', 'as' => 'login'));
Route::get('/login', array('uses' => 'LoginController@index', 'as' => 'login'));
Route::group(array('before' => 'admin'), function () {
Route::get('/edit-albums', array('uses' => 'AlbumsController@editAlbums', 'as' => 'edit-albums'));
});
Route::group(array('before' => 'auth'), function () {
Route::get('get_albums', function () {
return Album::with('songs.lyric', 'artworks', 'series')->get();
});
Route::get('get_profile', function () {
return User::with('actions')->with('user_details')->where('id', '=', 1)->get();
});
Route::get('/profile/{id}', array('uses' => 'ProfileController@getProfile', 'as' => 'user-profile'));
Route::group(array('prefix' => 'albums'), function () {
Route::get('/', array('uses' => 'AlbumsController@index', 'as' => 'albums-home'));
Route::get('/{slug}', array('uses' => 'AlbumsController@index', 'as' => 'albums-details'));
Route::post('/add-lyrics/{id}/save', array('uses' => 'AlbumsController@addLyrics', 'as' => 'add-lyrics'));
Route::post('/add-sample/{id}/save', array('uses' => 'AlbumsController@addSample', 'as' => 'add-sample'));
Route::group(array('before' => 'admin'), function () {
Route::get('/album/{id}/delete', array('uses' => 'AlbumsController@deleteAlbum', 'as' => 'delete-album'));
Route::get('/song/{id}/delete', array('uses' => 'AlbumsController@deleteSong', 'as' => 'delete-song'));
Route::group(array('before' => 'csrf'), function () {
Route::post('/newalbum', array('uses' => 'AlbumsController@saveAlbum', 'as' => 'save-album'));
示例2: showAllImages
public function showAllImages()
{
$albums = Album::with('images')->get();
return View::make('all', compact('albums'));
}
示例3: viewAllAlbums
public function viewAllAlbums()
{
$allAlbums = Album::with('owner')->get();
return View::make('albums.allAlbums', array('albums' => $allAlbums));
}