本文整理汇总了PHP中Gallery::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Gallery::where方法的具体用法?PHP Gallery::where怎么用?PHP Gallery::where使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gallery
的用法示例。
在下文中一共展示了Gallery::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: returnShortCodes
public static function returnShortCodes()
{
$tpl = static::returnTpl();
shortcode::add("gallery", function ($params = null) use($tpl) {
$default = array('tpl' => "gallery-default");
$params = array_merge($default, (array) $params);
if (empty($params['tpl']) || !View::exists($tpl . $params['tpl'])) {
throw new Exception('Template not found: ' . $tpl . $params['tpl']);
}
if (!isset($params['id'])) {
#return false;
#return "Error: id of gallery is not defined!";
throw new Exception('ID of gallery is not defined');
}
$gallery_id = $params['id'];
$gallery = Gallery::where('id', $gallery_id)->first();
if (!is_object($gallery) || !@$gallery->id) {
return false;
#return "Error: gallery #{$gallery_id} doesn't exist!";
}
$photos = $gallery->photos;
if (!$photos->count()) {
return false;
}
#dd($tpl.$params['tpl']);
#dd(compact($photos));
#return View::make($tpl.$params['tpl'], compact($photos)); ## don't work
return View::make($tpl . $params['tpl'], array('photos' => $photos));
});
}
示例2: index
function index($id = FALSE)
{
$data['categories'] = new Category($id);
$galleries = new Gallery();
if (@$_POST['category_id']) {
$id = $_POST['category_id'];
}
$data['galleries'] = $galleries->where('category_id', $id)->order_by('orderlist', 'asc')->get();
$this->template->build('admin/gallery_index', $data);
}
示例3: index
function index($id = FALSE)
{
$data['categories'] = new Category($id);
$galleries = new Gallery();
if (@$_POST['category_id']) {
$id = $_POST['category_id'];
}
$data['galleries'] = $galleries->where('category_id', $id)->order_by('id', 'desc')->get_page(limit());
$this->template->append_metadata(js_lightbox());
$this->template->build('admin/gallery_index', $data);
}
示例4: edit
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return Response
*/
public function edit($id)
{
$school = School::find($id);
if (is_null($school)) {
return Redirect::route('admin.galleries.index')->withErrors(array('mainError' => 'Галерията не е намерена.'));
} else {
if ($school->canUserEdit() == false) {
return Redirect::route('admin.schools.index')->withErrors(array('mainError' => 'Нямате право да редактирате учебното заведение.'));
}
$photos_data = Gallery::where('school_id', '=', $id)->get();
return View::make('admin.gallery.edit')->with('photos', $photos_data)->with('gallery_id', $id);
}
}
示例5: getPage
public function getPage($type, $slug = '')
{
$type_post = Type::where('type', $type)->first();
$posts_child = $galleries = $posts = $row = array();
if (empty($type_post)) {
return Response::view('errors.not-found')->header('Content-Type', '404 Not Found');
}
if ($type_post->template == 'gallery') {
$row = Post::where('slug', $type)->first();
$type_post = Type::where('id', $row->type_id)->first();
$galleries = Gallery::where('post_id', $row->id)->get();
} else {
if ($type_post->template == 'news') {
if ($slug == '') {
$posts = Post::where('type_id', $type_post->id)->where('status', 1)->where('parent', 0)->orderBy('created_at', 'desc')->paginate(6);
} else {
$row = Post::where('slug', $slug)->first();
}
foreach ($posts as $key => $post) {
$preview = HomeController::previewFirstSimbol($post->text, 500);
$post->preview = $preview['text'];
}
} else {
if ($type_post->template == 'portfolio') {
$posts = Post::where('type_id', $type_post->id)->where('status', 1)->where('parent', 0)->orderBy('order', 'asc')->get();
foreach ($posts as $key => $post) {
$post->galleries = Gallery::where('post_id', $post->id)->get();
}
} else {
$posts = Post::where('type_id', $type_post->id)->where('status', 1)->where('parent', 0)->orderBy('order', 'asc')->get();
$posts_child = Post::where('type_id', $type_post->id)->where('status', 1)->where('parent', '!=', 0)->orderBy('order', 'asc')->get();
if ($slug != '') {
$row = Post::where('slug', $slug)->first();
if ($row->parent != 0) {
$parent = Post::where('id', $row->parent)->first();
$row->parent_title = $parent->name;
$row->parent_slug = $parent->slug;
}
$galleries = Gallery::where('post_id', $row->id)->get();
}
}
}
}
$view = array('type' => $type_post, 'posts' => $posts, 'posts_child' => $posts_child, 'row' => $row, 'galleries' => $galleries);
return View::make('home.' . $type_post->template, $view);
}
示例6: getContent
public function getContent($type_id = 'content', $id = 'edit')
{
if ($type_id == 'content' && $id == 'edit') {
$posts = Type::orderBy('created_at', 'desc')->get();
return View::make('admin.content')->with('posts', $posts);
}
$posts = Post::where('type_id', '=', $type_id)->where('parent', '=', '0')->orderBy('created_at', 'desc')->get();
$posts_child = Post::where('type_id', '=', $type_id)->where('parent', '!=', '0')->orderBy('created_at', 'desc')->get();
$view = array('posts' => $posts, 'posts_child' => $posts_child, 'type_id' => $type_id);
$templates = array('page' => 'Текст', 'gallery' => 'Галерея');
//добавляем категорию
if ($type_id == 'type' && $id == 'add') {
$view['templates'] = $templates;
return View::make('admin.post-type', $view);
}
//редактируем категорию
if ($id == 'edit') {
$post = Type::where('id', $type_id)->first();
$view['row'] = $post;
$view['templates'] = $templates;
return View::make('admin.post-type', $view);
} else {
if (is_numeric($id) || $id == 'add') {
$post = Post::find($id);
$galleries = Gallery::where('post_id', $id)->get();
$parent[0] = '';
foreach ($posts as $value) {
if ($value->id != $id) {
$parent[$value['id']] = $value['name'];
}
}
$view['galleries'] = $galleries;
$view['parent'] = $parent;
$view['row'] = $post;
return View::make('admin.posts', $view);
}
}
}
示例7: foreach
$sliders[$index]['photo_name'] = Photo::where('id', $slider['photo'])->pluck('name');
}
}
}
if ($communications = Dictionary::valuesBySlug('communications_units', function ($query) {
$query->orderBy('lft', 'ASC');
}, 'all', TRUE)) {
foreach ($communications as $index => $communication) {
if ($communication['photo']) {
$communications[$index]['photo_name'] = Photo::where('id', $communication['photo'])->pluck('name');
}
}
}
$gallery = array();
if (Gallery::where('name', 'Галерея на главной')->exists()) {
$gallery = Gallery::where('name', 'Галерея на главной')->first()->photos;
}
?>
@extends(Helper::layout())
@section('style')
@stop
@section('content')
@if(count($sliders))
<div class="index-slider js-index-slider">
<div class="slider__list">
@foreach($sliders as $slider)
@if(isset($slider['photo_name']) && File::exists(Config::get('site.galleries_photo_dir').'/'.$slider['photo_name']))
<div style="background-image: url({{ asset(Config::get('site.galleries_photo_public_dir').'/'.$slider['photo_name']) }});"
class="list__item js-slide">
<div class="wrapper">
<div class="item-content">
示例8: function
if (File::exists($filename)) {
File::delete($filename);
}
$package->delete();
}
}
});
/*---------------------------------------------------*/
//home
Route::get('/', function () {
$data['room'] = Rooms::select('roomtype.RoomType_Name', 'roomtype.ID_RoomType', 'roomtype_pic.Picture')->join('roomtype_pic', 'roomtype.ID_RoomType', '=', 'roomtype_pic.ID_RoomType')->where('roomtype_pic.Main_Pic', '=', 'YES')->where('roomtype.Status', '=', 'Active')->take(40)->get()->all();
$data['offer'] = Offer::where('Status', '=', 'Active')->take(40)->get()->all();
$data['dinas'] = Dinasevents::select(DB::raw("Event_ID, Event_Picture, Event_Date, Event_Title, CONCAT(SUBSTRING(Event_Description,1,100),'...') as IsiEvent"))->orderby('Event_Date', 'DESC')->take(40)->get()->all();
$data['travel'] = Travel::where('Status', '=', 'Active')->take(40)->get()->all();
$data['destination'] = Destination::where('Status', '=', 'Active')->take(40)->get()->all();
$data['gallery'] = Gallery::where("Status", "!=", "Delete")->get()->all();
$data['about'] = About::get()->all();
Session::put('key', 'expiry', 1);
$value = Session::get('key');
return View::make('home')->with('index', 'active')->with('data', $data);
});
Route::get('post/listing', array('uses' => 'PostController@listing', 'as' => 'get.post.listing'));
Route::get('post/{id}', array('uses' => 'PostController@single', 'as' => 'get.post.single'))->where(array('id' => '[1-9][0-9]*', 'slug' => '[a-zA-Z0-9-_]+'));
Route::post('post/{id}', array('uses' => 'PostController@update', 'as' => 'post.post.update'))->where(array('id' => '[1-9][0-9]*'));
Route::resource('user', 'UserController');
//resource
Route::resource('/tourism', 'DestinationController');
Route::resource('/book', 'BooksController');
Route::resource('/rooms', 'RoomsController');
Route::resource('/facilities', 'FacilitiesController');
Route::resource('/news', 'NewsController');
示例9: function
$user = Sentry::getUser();
$getCategoryData = Gallery::where('category', '=', $id)->orderBy('position')->get();
return View::make('frontend.gallery-innerd')->with('showForCategory', true)->with('getCategoryData', $getCategoryData);
});
Route::get('/mobile/gallery/show/', function () {
$user = Sentry::getUser();
return View::make('frontend.gallery-mobile')->with('showForCategory', false)->with('getCategoryData', []);
});
Route::get('/mobile/gallery/show/{name}/{id}', function ($name, $id) {
$user = Sentry::getUser();
$getCategoryData = Gallery::where('category', '=', $id)->orderBy('position')->get();
return View::make('frontend.gallery-mobile')->with('showForCategory', true)->with('getCategoryData', $getCategoryData);
});
Route::get('/mobile/gallery/show/{catname}/{name}/{id}', function ($catname, $name, $id) {
$user = Sentry::getUser();
$getCategoryData = Gallery::where('category', '=', $id)->orderBy('position')->get();
return View::make('frontend.gallery-mobile')->with('showForCategory', true)->with('getCategoryData', $getCategoryData);
});
# Home Page Index
Route::get('/', function () {
// Get if mobile device
//
$useragent = $_SERVER['HTTP_USER_AGENT'];
if (preg_match('/(android|bb\\d+|meego).+mobile|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i', $useragent) || preg_match('/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\\-(n|u)|c55\\/|capi|ccwa|cdm\\-|cell|chtm|cldc|cmd\\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\\-s|devi|dica|dmob|do(c|p)o|ds(12|\\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\\-|_)|g1 u|g560|gene|gf\\-5|g\\-mo|go(\\.w|od)|gr(ad|un)|haie|hcit|hd\\-(m|p|t)|hei\\-|hi(pt|ta)|hp( i|ip)|hs\\-c|ht(c(\\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\\-(20|go|ma)|i230|iac( |\\-|\\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\\/)|klon|kpt |kwc\\-|kyo(c|k)|le(no|xi)|lg( g|\\/(k|l|u)|50|54|\\-[a-w])|libw|lynx|m1\\-w|m3ga|m50\\/|ma(te|ui|xo)|mc(01|21|ca)|m\\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\\-2|po(ck|rt|se)|prox|psio|pt\\-g|qa\\-a|qc(07|12|21|32|60|\\-[2-7]|i\\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\\-|oo|p\\-)|sdk\\/|se(c(\\-|0|1)|47|mc|nd|ri)|sgh\\-|shar|sie(\\-|m)|sk\\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\\-|v\\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\\-|tdg\\-|tel(i|m)|tim\\-|t\\-mo|to(pl|sh)|ts(70|m\\-|m3|m5)|tx\\-9|up(\\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\\-|your|zeto|zte\\-/i', substr($useragent, 0, 4))) {
// Redirect to mobile device
return Redirect::to('/mobilesite');
}
if (preg_match('/(tablet|ipad|playbook)|(android(?!.*(mobi|opera mini)))/i', strtolower($_SERVER['HTTP_USER_AGENT']))) {
// Redirect to mobile device
return Redirect::to('/mobilesite');
}
示例10: info
public function info()
{
return Gallery::where("id", $this->gallery_id)->first();
}
示例11: hasGalleryAttribute
public function hasGalleryAttribute()
{
return Gallery::where('id', $this->gallery_id)->get();
}
示例12: foreach
<!-- -->
<div class="col-xs-12 give-green-shade cht-push-right">
<!-------->
<div class="col-lg-12 chy-left-text ">
<?php
if (!$showForCategory) {
$allCatImages = '';
$getAllCategory = Category::get();
foreach ($getAllCategory as $cats) {
if ($cats->name != 'None...') {
$categoryData = Gallery::where('category', '=', $cats->id)->orderBy('position')->first();
if ($categoryData) {
$link = '/gallery/show/' . $cats->name . '/' . $cats->id;
$allCatImages = $allCatImages . '
<div class="col-md-4 portfolio-item galleryitem bw">
<a href="' . $link . '">
<img class="img-responsive" src="/' . $categoryData->imageurl . '" alt="">
</a>
<p>' . $cats->name . '</p>
</div>';
} else {
$getSubCategorys = Category::where('parent', '=', $cats->id)->orderBy('position')->first();
if ($getSubCategorys) {
$subcatshtml = '';
$subLink = '/gallery/show/' . $category->name . '/' . $subcats->name . '/' . $subcats->id;
$allCatImages = $allCatImages . '
示例13: function
Route::get('/faqs', function () {
$organisation = Organisation::find(1);
// Get all FAQ data
$faqs = $organisation->faqs()->order_by('sort_order', 'asc')->get();
// Get search term data
$search = \Laravel\Input::get('search', '');
// Load FAQ data
if (!empty($search)) {
$search_faqs = $organisation->faqs()->where(function ($query) use($search) {
$query->where('answer', 'LIKE', '%' . $search . '%')->or_where('question', 'LIKE', '%' . $search . '%');
})->order_by('sort_order', 'asc')->get();
}
return View::make('pages.faqs')->with('faqs', $faqs)->with('search', $search)->with('search_faqs', $search_faqs);
});
Route::get('/galleries/(:any)', function ($gallery) {
$gallery = Gallery::where('slug', '=', $gallery)->first();
$organisation = Organisation::find(1);
$images = $gallery->images;
$galleries = $organisation->galleries()->order_by('sort_order', 'asc')->get();
return View::make('pages.gallery')->with('images', $images)->with('gallery', $gallery)->with('galleries', $galleries);
});
Route::get('/videos', function () {
$images = Gallery::find(2)->images;
$organisation = Organisation::find(1);
$galleries = $organisation->galleries()->order_by('sort_order', 'asc')->get();
return View::make('pages.videos')->with('images', $images)->with('galleries', $galleries);
});
Route::get('/support', function () {
$organisation = Organisation::find(1);
$testimonials = $organisation->testimonials()->order_by(DB::raw('RAND()'))->take(2)->get();
$galleries = $organisation->galleries()->order_by('sort_order', 'asc')->get();
示例14: array
<?
/**
* TITLE: Фотографии
* AVAILABLE_ONLY_IN_ADVANCED_MODE
*/
?>
<?php
$gallery = array();
if (Gallery::where('name', 'Основная галерея')->exists()) {
$gallery = Gallery::where('name', 'Основная галерея')->first()->photos;
}
?>
@extends(Helper::layout())
@section('style')
@stop
@section('content')
<div class="wrapper relative">
<div class="wrapper-photos">
<h1 class="us-title title-photos page-full"><span>{{ $page->seo->h1 }}</span></h1>
</div>
</div>
@if(count($gallery))
<div class="block-photos">
@foreach($gallery as $photo)
<div class="photos__item">
<a rel="photos" href="{{ asset(Config::get('site.galleries_photo_public_dir').'/'.$photo->name) }}"
class="item__link js-fancybox">
<span style="background-image: url({{ asset(Config::get('site.galleries_photo_public_dir').'/'.$photo->name) }});"
class="link__back"></span>
<span class="link__hover"></span>
</a>
示例15: getShow
public function getShow($id)
{
$user = $this->user->findOrFail($id);
// $userid = Sentry::getUser()->id;
// var_dump($userid); die();
$userid = User::findOrFail($id)->id;
$useremail = User::findOrFail($id)->email;
// var_dump($userid); die();
$galleries = Gallery::where('user_id', '=', $userid)->get();
$credentials = Credential::where('user_id', '=', $userid)->get();
$reviews = Review::where('to', '=', $useremail)->get();
// $services =
// $user = sentry::getUser();
// var_dump($user); die('here');
// $user = Sentry::findUserById($id);
// if(All::checkViewRight($user)):
// return All::checkViewRight($user);
// endif;
// return $galleries; die();
// return $reviews; die('jere');
return View::make('users.show', compact('user', 'galleries', 'reviews'));
// return View::make('users.show', compact('user'));
}