当前位置: 首页>>代码示例>>PHP>>正文


PHP Photo::whereIn方法代码示例

本文整理汇总了PHP中Photo::whereIn方法的典型用法代码示例。如果您正苦于以下问题:PHP Photo::whereIn方法的具体用法?PHP Photo::whereIn怎么用?PHP Photo::whereIn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Photo的用法示例。


在下文中一共展示了Photo::whereIn方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: postAjaxOrderSave

 public function postAjaxOrderSave()
 {
     $poss = Input::get('poss');
     $pls = Photo::whereIn('id', $poss)->get();
     if ($pls) {
         foreach ($pls as $pl) {
             $pl->order = array_search($pl->id, $poss);
             $pl->save();
         }
     }
     return Response::make('1');
 }
开发者ID:Grapheme,项目名称:amway,代码行数:12,代码来源:admin_galleries.controller.php

示例2: function

 */
?>
<?php 
$sliders = Dic::valuesBySlug('slider_in_main', function ($query) {
    $query->orderBy("dictionary_values.lft");
}, 'all', TRUE);
$images = array();
if (count($sliders)) {
    $images_ids = array();
    foreach ($sliders as $index => $slider) {
        if (!empty($slider->slide)) {
            $images_ids[] = $slider->slide;
        }
    }
    if (!empty($images_ids)) {
        foreach (Photo::whereIn('id', $images_ids)->get() as $image) {
            $images[$image->id] = $image->name;
        }
    }
}
?>
@extends(Helper::layout())
@section('style')
@stop
@section('content')
    @if(count($sliders))
        <div id="carousel" class="cf" style="margin-bottom: 0;">
            <div class="photo-wrapper clear">
                @foreach($sliders as $slider)
                    @if(isset($slider->slide) && isset($images[$slider->slide]))
                        <a class="promo-banner"
开发者ID:Grapheme,项目名称:newyork.bar,代码行数:31,代码来源:index.blade.php

示例3: loadImages


//.........这里部分代码省略.........
              */
             if (is_numeric($work_obj->{$attr})) {
                 /**
                  * Собираем ID изображений из обычных полей
                  */
                 $images_ids_attr[$attr][] = $work_obj->{$attr};
                 $images_ids[] = $work_obj->{$attr};
             } elseif (isset($work_obj->allfields) && count($work_obj->allfields)) {
                 /**
                  * Собираем ID изображений из i18n полей
                  */
                 #Helper::tad($work_obj->allfields);
                 foreach ($work_obj->allfields as $locale_sign => $locale_fields) {
                     foreach ($locale_fields as $locale_key => $locale_value) {
                         if ($locale_key == $attr) {
                             #Helper::tad($locale_key . ' == ' . $attr);
                             /**
                              * Work good
                              */
                             $images_ids[] = $locale_value;
                         }
                         #Helper::tad($locale_key);
                     }
                 }
             }
         }
     }
     #Helper::dd($images_ids);
     #Helper::d($images_ids_attr);
     #Helper::ta($images_locale_ids_attr);
     #Helper::tad($images_locale_ids);
     $images = [];
     if (count($images_ids)) {
         $images = Photo::whereIn('id', $images_ids);
         if (NULL != ($db_remember_timeout = Config::get('app.settings.main.db_remember_timeout')) && $db_remember_timeout > 0) {
             $images->remember($db_remember_timeout);
         }
         $images = $images->get();
         $images = self::modifyKeys($images, 'id');
         #Helper::tad($images);
     }
     #dd($collection);
     if (count($images)) {
         /**
          * Перебираем все объекты в коллекции
          */
         foreach ($collection as $o => $obj) {
             /**
              * Если при вызове указано поле (связь) - берем ее вместо текущего объекта
              */
             $work_obj = $field ? $obj->{$field} : $obj;
             /**
              * Перебираем все переданные ключи с ID изображений
              */
             foreach ($key as $attr) {
                 if (is_object($work_obj)) {
                     #Helper::tad($work_obj);
                     if (isset($work_obj->{$attr}) && is_numeric($work_obj->{$attr})) {
                         /**
                          * Заменяем ID изображений на объекты в обычных полях
                          */
                         if (@$images[$work_obj->{$attr}]) {
                             $tmp = $work_obj->{$attr};
                             $image = $images[$tmp];
                             $work_obj->setAttribute($attr, $image);
                         }
开发者ID:Grapheme,项目名称:dada,代码行数:67,代码来源:DicLib.php

示例4: show

 /**
  * Display the specified resource.
  * GET /recettes/{id}
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $recette = Recette::find($id);
     // On ajoute le pays pour la recette.
     $recette['country'] = array();
     $countries = Country::where('id', '=', $recette['idPays'])->firstOrFail();
     $recette['country'] = $countries->nom;
     // On ajoute les auteurs pour la recette.
     $recette['authors'] = array();
     $listIdauthors = DB::table('link_recette_author')->where('idRecette', '=', $recette['id'])->lists('idAutheur');
     // On recherche les id de tous les auteurs de la recette
     $autheurs = Autheur::whereIn('id', $listIdauthors)->lists('nom');
     // on recherche tous les noms des auteurs de la recette.
     $recette['authors'] = $autheurs;
     // On ajoute les catégories pour la recette.
     $recette['categories'] = array();
     $listIdcategories = DB::table('link_recette_categorie')->where('idRecette', '=', $recette['id'])->lists('idCategorie');
     $categories = Categorie::whereIn('id', $listIdcategories)->lists('nom');
     $recette['categories'] = $categories;
     // On ajoute les photos pour chaque recette.
     $recette['photos'] = array();
     $listIdphotos = DB::table('link_recette_photo')->where('idRecette', '=', $recette['id'])->lists('idPhoto');
     $photos = Photo::whereIn('id', $listIdphotos)->lists('nom');
     $recette['photos'] = $photos;
     // On ajoute la liste de chaque categorie d'ingredients pour chaque recette.
     $recette['ingredients'] = array();
     $listIdCategorieIngred = DB::table('link_recette_ingred')->where('idRecette', '=', $recette['id'])->distinct()->lists('idCategorie');
     $listIdIngred = DB::table('link_recette_ingred')->where('idRecette', '=', $recette['id'])->lists('idIngredient');
     $listQuantIngred = DB::table('link_recette_ingred')->where('idRecette', '=', $recette['id'])->lists('idQuantite');
     $listOrdreIngred = DB::table('link_recette_ingred')->where('idRecette', '=', $recette['id'])->lists('Ordre');
     // On met dans un tableau le nombre d'ingredient par categorie
     $listNbrIngrParCat = array();
     foreach ($listIdCategorieIngred as $idCatIngre) {
         $listNbrIngrParCat[sizeof($listNbrIngrParCat)] = DB::table('link_recette_ingred')->where('idRecette', '=', $recette['id'])->where('idCategorie', '=', $idCatIngre)->distinct()->count();
     }
     //On récupère le nom des catégories.
     $nomsCatIngredients = CategorieIngredient::whereIn('id', $listIdCategorieIngred)->lists('nom');
     $ingredients = array();
     foreach ($listIdIngred as $idIngredCurrent) {
         $ing = Ingredient::where('id', '=', $idIngredCurrent)->firstOrFail();
         array_push($ingredients, $ing->nom);
     }
     $ingredientsFinal = array();
     for ($j = 0; $j < sizeof($listIdCategorieIngred); $j++) {
         $ingredientsArray = array();
         $offset = 0;
         // on a créé un décalage pour parcourir la lsite des ingrédients.
         if ($j != 0) {
             $offset = $listNbrIngrParCat[$j - 1];
         }
         for ($i = 0 + $offset; $i < $listNbrIngrParCat[$j] + $offset; $i++) {
             $ingredientsArray[$i] = array('Ordre' => $listOrdreIngred[$i], 'Ingredient' => $ingredients[$i], 'lien' => "");
         }
         $ingredientsFinal[$j] = array('Titre' => $nomsCatIngredients[$j], 'DetailsIngre' => $ingredientsArray);
     }
     $recette['ingredients'] = $ingredientsFinal;
     // On ajoute la liste de chaque categorie de préparations pour la recette.
     $recette['preparations'] = array();
     $listIdCategoriePrepa = DB::table('link_recette_preparation')->where('idRecette', '=', $recette['id'])->distinct()->lists('idCatPrepa');
     $listIdPhrasePrepa = DB::table('link_recette_preparation')->where('idRecette', '=', $recette['id'])->lists('idPhrasePrepa');
     $listOrdrePhrase = DB::table('link_recette_preparation')->where('idRecette', '=', $recette['id'])->lists('Ordre');
     // On met dans un tableau le nombre de phrase de préparation par categorie
     $listNbrPhraseParCat = array();
     foreach ($listIdCategoriePrepa as $idCatPrepa) {
         $listNbrPhraseParCat[sizeof($listNbrPhraseParCat)] = DB::table('link_recette_preparation')->where('idRecette', '=', $recette['id'])->where('idCatPrepa', '=', $idCatPrepa)->distinct()->count();
     }
     //On récupère le nom des catégories de préparation.
     $nomsCatPhrase = CategoriePrepa::whereIn('id', $listIdPhrasePrepa)->lists('nom');
     $phrases = array();
     foreach ($listIdPhrasePrepa as $idPhrasePrepaCurrent) {
         $phrase = PhrasePrepa::where('id', '=', $idPhrasePrepaCurrent)->firstOrFail();
         array_push($phrases, $phrase->phrase);
     }
     $phrasesFinal = array();
     for ($j = 0; $j < sizeof($listIdCategoriePrepa); $j++) {
         $phrasesArray = array();
         $offset = 0;
         // on a créé un décalage pour parcourir la lsite des ingrédients.
         if ($j != 0) {
             $offset = $listNbrPhraseParCat[$j - 1];
         }
         for ($i = 0 + $offset; $i < $listNbrPhraseParCat[$j] + $offset; $i++) {
             $phrasesArray[$i] = array('Ordre' => $listOrdrePhrase[$i], 'Phrase' => $phrases[$i]);
         }
         $phrasesFinal[$j] = array('Titre' => $nomsCatPhrase[$j], 'Phrases' => $phrasesArray);
     }
     $recette['preparations'] = $phrasesFinal;
     return Response::json($recette);
 }
开发者ID:Defoncesko,项目名称:iamhungry,代码行数:96,代码来源:RecettesController.php

示例5: foreach

        <span class='btn btn-primary btn-sm save-image-data' data-photo-id='{{ $photo->id }}'>Сохранить</span>
    </div>
</div>" data-image-title="{{ $photo->title }}" data-html="true">

                            <span class="photo-preview sortable_item" data-id="{{ $photo->id }}" style="background-image:url({{ URL::to($photo->thumb()) }});">

                                {{--<a href="{{ URL::to($photo->path()) }}" target="_blank" title="Полноразмерное изображение" style="display:block; height:100%; color:#090; background:transparent; display:none"></a>--}}

                                <span href="#" class="photo-delete" data-photo-id="{{ $photo->id }}" style="">Удалить</span>
                            </span>

                        </a>


                    @endforeach
                </div>
            @endif
        @endif

    </div>
    <div class="clear"></div>
<?
#/*
if (isset($bad_photos) && is_array($bad_photos) && count($bad_photos) && Input::get('delete_bad_photos') == 1) {
    #Photo::whereIn('id', $bad_photos)->full_delete();
    $photos = Photo::whereIn('id', $bad_photos)->get();
    foreach ($photos as $photo)
        $photo->full_delete();
}
#*/
?>
开发者ID:Grapheme,项目名称:amway,代码行数:31,代码来源:extform_gallery.blade.php

示例6: getPhotoByAlbum

 public static function getPhotoByAlbum($checked_albums, $pagination = 30)
 {
     $album_ids = Album::getIdByName($checked_albums);
     return Photo::whereIn('album_id', $album_ids)->orderBy('id', 'desc')->paginate($pagination);
 }
开发者ID:rituzy,项目名称:iblog,代码行数:5,代码来源:Photo.php


注:本文中的Photo::whereIn方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。