예제 #1
0
파일: Tag.php 프로젝트: bjrnblm/blender
 public function getTypeAttribute()
 {
     return $this->attributes['type'] ?: HasTags::getDefaultTagType();
 }
예제 #2
0
 /**
  * Get a tag from it's url.
  *
  * @param string $url
  * @param string $locale
  *
  * @return \App\Models\Tag
  */
 public function findByUrl($url, $type = null, $locale = null)
 {
     $type = $type ?: HasTags::getDefaultTagType();
     $locale = $locale ?: content_locale();
     return $this->model->where('type', $type)->whereHas('translations', function ($query) use($url, $locale) {
         $query->where('url', $url)->where('locale', $locale);
     })->first();
 }