Ejemplo n.º 1
0
 public function getAllMediaByActiveLocaleAndType($type)
 {
     $input = "";
     $media = Media::with('translations.locale')->with(array('translations' => function ($query) use($input) {
         $query->whereHas('locale', function ($q) {
             // ...1 subquery to filter the active locales
             $q->where('status', '<>', 'disabled');
         });
     }, 'translations.' . $type . 's', 'created_by_user'))->with(array('translations' => function ($q1) {
         // 1 query for template of the sitemap with nested collections
         $q1->whereHas('locale', function ($q2) {
             // ...1 subquery to filter locale by active language
             $q2->where('identifier', '' . app()->getLocale() . '');
         });
     }))->where('media_type', '' . $type . '')->get();
     //dc($media->first()->translations);
     return $media;
 }
Ejemplo n.º 2
0
 /**
  * @return \Illuminate\Database\Eloquent\Builder|static
  */
 public function getElqMediaTranslationAsBO()
 {
     $media = Media::with(['translation']);
     return $media;
     //\Illuminate\Database\Eloquent\Collection|static
 }