本文整理匯總了PHP中app\Photo::join方法的典型用法代碼示例。如果您正苦於以下問題:PHP Photo::join方法的具體用法?PHP Photo::join怎麽用?PHP Photo::join使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類app\Photo
的用法示例。
在下文中一共展示了Photo::join方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: index
/**
* Show the application dashboard to the user.
*
* @return Response
*/
public function index()
{
$articles = Article::with('author')->orderBy('position', 'DESC')->orderBy('created_at', 'DESC')->limit(4)->get();
// TODO: abstract to model
$sliders = Photo::join('photo_albums', 'photo_albums.id', '=', 'photos.photo_album_id')->where('photos.slider', 1)->orderBy('photos.position', 'DESC')->orderBy('photos.created_at', 'DESC')->select('photos.filename', 'photos.name', 'photos.description', 'photo_albums.folder_id')->get();
$photoAlbums = PhotoAlbum::select(array('photo_albums.id', 'photo_albums.name', 'photo_albums.description', 'photo_albums.folder_id', DB::raw('(select filename from ' . DB::getTablePrefix() . 'photos WHERE album_cover=TRUE and ' . DB::getTablePrefix() . 'photos.photo_album_id=' . DB::getTablePrefix() . 'photo_albums.id LIMIT 1) AS album_image'), DB::raw('(select filename from ' . DB::getTablePrefix() . 'photos WHERE ' . DB::getTablePrefix() . 'photos.photo_album_id=' . DB::getTablePrefix() . 'photo_albums.id ORDER BY position ASC, id ASC LIMIT 1) AS album_image_first')))->limit(8)->get();
$videoAlbums = VideoAlbum::select(array('video_albums.id', 'video_albums.name', 'video_albums.description', 'video_albums.folder_id', DB::raw('(select youtube from ' . DB::getTablePrefix() . 'videos WHERE album_cover=TRUE and ' . DB::getTablePrefix() . 'videos.video_album_id=' . DB::getTablePrefix() . 'video_albums.id LIMIT 1) AS album_image'), DB::raw('(select youtube from ' . DB::getTablePrefix() . 'videos WHERE ' . DB::getTablePrefix() . 'videos.video_album_id=' . DB::getTablePrefix() . 'video_albums.id ORDER BY position ASC, id ASC LIMIT 1) AS album_image_first')))->limit(8)->get();
$categoriesArray = Object::where('type', 'category')->get();
$categories = array();
foreach ($categoriesArray as $category) {
$categories[] = array($category->title);
}
$categories = Object::where('type', 'category')->get();
global $types;
$types = Object::getTypes()->select(array('id', DB::raw("REPLACE(name, '_object_type_', '') as name"), DB::raw("REPLACE(title, 'Object Type: ', '') as title"), 'created_at'))->get();
return view('pages.home', compact('articles', 'sliders', 'videoAlbums', 'photoAlbums', 'categories', 'types'));
//return view('pages.welcome');
}
示例2: index
public function index()
{
$news = $this->news->orderBy('position', 'DESC')->orderBy('created_at', 'DESC')->limit(4)->get();
$sliders = Photo::join('photo_album', 'photo_album.id', '=', 'photo.photo_album_id')->where('photo.slider', 1)->orderBy('photo.position', 'DESC')->orderBy('photo.created_at', 'DESC')->select('photo.filename', 'photo.name', 'photo.description', 'photo_album.folderid')->get();
$photoalbums = PhotoAlbum::select(array('photo_album.id', 'photo_album.name', 'photo_album.description', 'photo_album.folderid', DB::raw('(select filename from ' . DB::getTablePrefix() . 'photo WHERE album_cover=TRUE and ' . DB::getTablePrefix() . 'photo.photo_album_id=' . DB::getTablePrefix() . 'photo_album.id) AS album_image'), DB::raw('(select filename from ' . DB::getTablePrefix() . 'photo WHERE ' . DB::getTablePrefix() . 'photo.photo_album_id=' . DB::getTablePrefix() . 'photo_album.id ORDER BY position ASC, id ASC LIMIT 1) AS album_image_first')))->limit(8)->get();
$videoalbums = VideoAlbum::select(array('video_album.id', 'video_album.name', 'video_album.description', 'video_album.folderid', DB::raw('(select youtube from ' . DB::getTablePrefix() . 'video as v WHERE album_cover=TRUE and v.video_album_id=' . DB::getTablePrefix() . 'video_album.id) AS album_image'), DB::raw('(select youtube from ' . DB::getTablePrefix() . 'video WHERE ' . DB::getTablePrefix() . 'video.video_album_id=' . DB::getTablePrefix() . 'video_album.id ORDER BY position ASC, id ASC LIMIT 1) AS album_image_first')))->limit(8)->get();
return view('site.home.index', compact('news', 'sliders', 'videoalbums', 'photoalbums'));
}
示例3: index
/**
* Show the application dashboard to the user.
*
* @return Response
*/
public function index()
{
$articles = Article::with('author')->orderBy('position', 'DESC')->orderBy('created_at', 'DESC')->limit(4)->get();
// TODO: abstract to model
$sliders = Photo::join('photo_albums', 'photo_albums.id', '=', 'photos.photo_album_id')->where('photos.slider', 1)->orderBy('photos.position', 'DESC')->orderBy('photos.created_at', 'DESC')->select('photos.filename', 'photos.name', 'photos.description', 'photo_albums.folder_id')->get();
$photoAlbums = PhotoAlbum::select(array('photo_albums.id', 'photo_albums.name', 'photo_albums.description', 'photo_albums.folder_id', DB::raw('(select filename from ' . DB::getTablePrefix() . 'photos WHERE album_cover=TRUE and ' . DB::getTablePrefix() . 'photos.photo_album_id=' . DB::getTablePrefix() . 'photo_albums.id LIMIT 1) AS album_image'), DB::raw('(select filename from ' . DB::getTablePrefix() . 'photos WHERE ' . DB::getTablePrefix() . 'photos.photo_album_id=' . DB::getTablePrefix() . 'photo_albums.id ORDER BY position ASC, id ASC LIMIT 1) AS album_image_first')))->limit(8)->get();
$videoAlbums = VideoAlbum::select(array('video_albums.id', 'video_albums.name', 'video_albums.description', 'video_albums.folder_id', DB::raw('(select youtube from ' . DB::getTablePrefix() . 'videos WHERE album_cover=TRUE and ' . DB::getTablePrefix() . 'videos.video_album_id=' . DB::getTablePrefix() . 'video_albums.id LIMIT 1) AS album_image'), DB::raw('(select youtube from ' . DB::getTablePrefix() . 'videos WHERE ' . DB::getTablePrefix() . 'videos.video_album_id=' . DB::getTablePrefix() . 'video_albums.id ORDER BY position ASC, id ASC LIMIT 1) AS album_image_first')))->limit(8)->get();
return view('pages.home', compact('articles', 'sliders', 'videoAlbums', 'photoAlbums'));
//return view('pages.welcome');
}
示例4: data
/**
* Show a list of all the languages posts formatted for Datatables.
*
* @return Datatables JSON
*/
public function data()
{
$photos = Photo::join('languages', 'languages.id', '=', 'photos.language_id')->join('photo_albums', 'photo_albums.id', '=', 'photos.photo_album_id')->whereNull('photo_albums.deleted_at')->orderBy('photos.position')->select(array('photos.id', 'photos.name', 'photo_albums.name as category', 'photos.album_cover', 'photos.slider', 'languages.name as language', 'photos.created_at'));
return Datatables::of($photos)->add_column('actions', '<a href="{{{ URL::to(\'admin/photo/\' . $id . \'/edit\' ) }}}" class="btn btn-success btn-sm iframe" >{{ trans("admin/modal.edit") }}</a>
<a href="{{{ URL::to(\'admin/photo/\' . $id . \'/delete\' ) }}}" class="btn btn-sm btn-danger iframe">{{ trans("admin/modal.delete") }}</a>
<input type="hidden" name="row" value="{{$id}}" id="row">')->make();
}
示例5: data
/**
* Show a list of all the languages posts formatted for Datatables.
*
* @return Datatables JSON
*/
public function data($albumid = 0)
{
$condition = intval($albumid) == 0 ? ">" : "=";
$photoalbum = Photo::join('languages', 'languages.id', '=', 'photos.language_id')->join('photo_albums', 'photo_albums.id', '=', 'photos.photo_album_id')->where('photos.photo_album_id', $condition, $albumid)->orderBy('photos.position')->select(array('photos.id', DB::raw($albumid . ' as albumid'), DB::getTablePrefix() . 'photos.name', 'photo_albums.name as category', DB::getTablePrefix() . 'photos.album_cover', DB::getTablePrefix() . 'photos.slider', 'languages.name as language', DB::getTablePrefix() . 'photos.created_at'));
return Datatables::of($photoalbum)->edit_column('album_cover', '<a href="{{{ URL::to(\'admin/photo/\' . $id . \'/\' . $albumid . \'/albumcover\' ) }}}" class="btn btn-warning btn-sm" >@if ($album_cover=="1") <span class="glyphicon glyphicon-ok"></span> @else <span class=\'glyphicon glyphicon-remove\'></span> @endif</a>')->edit_column('slider', '<a href="{{{ URL::to(\'admin/photo/\' . $id . \'/\' . $albumid . \'/slider\' ) }}}" class="btn btn-warning btn-sm" >@if ($slider=="1") <span class=\'glyphicon glyphicon-ok\'></span> @else <span class=\'glyphicon glyphicon-remove\'></span> @endif</a>')->add_column('actions', '<a href="{{{ URL::to(\'admin/photo/\' . $id . \'/edit\' ) }}}" class="btn btn-success btn-sm iframe" ><span class="glyphicon glyphicon-pencil"></span> {{ trans("admin/modal.edit") }}</a>
<a href="{{{ URL::to(\'admin/photo/\' . $id . \'/delete\' ) }}}" class="btn btn-sm btn-danger iframe"><span class="glyphicon glyphicon-trash"></span> {{ trans("admin/modal.delete") }}</a>
<input type="hidden" name="row" value="{{$id}}" id="row">')->remove_column('id')->remove_column('albumid')->make();
}