Merhaba,
Laravelde arama işlemi için Scout ve Algolia kullanıyorum. 6 ayrı model için indexleme yaptım. Tüm modellerimde int türünde publish alanı mevcut. Arama sonuçlarına da örneğin
Model::search('key')->where('publish', 1)->get()
Şeklinde sadece yayında olan içeriklerimi gösteriyorum. 6 model in 5 inde where sorgum çalışırken 1 tanesinde çalışmıyor. Where sorgusu yapmadan dönen veriyi debug ettiğimde publish alanının 1 olduğunu görebiliyorum. Ama sorguya dahil ettiğimde sonuç alamıyorum. Sebebi sizce ne olabilir? Dönen verim aşağıdaki gibidir.
Collection {#1242 ▼
#items: array:1 [▼
0 => Page {#1230 ▼
+translationModel: "App\Models\PageTranslation"
+translatedAttributes: array:4 [▼
0 => "name"
1 => "slug"
2 => "description"
3 => "details"
]
#fillable: array:12 [▼
0 => "name"
1 => "slug"
2 => "description"
3 => "details"
4 => "page_category_id"
5 => "image"
6 => "icon"
7 => "custom_template"
8 => "author_id"
9 => "updater_id"
10 => "section_id"
11 => "publish"
]
#appends: array:8 [▼
0 => "image_url"
1 => "icon_url"
2 => "page_url"
3 => "trans_name"
4 => "trans_desc"
5 => "trans_clear_desc"
6 => "trans_details"
7 => "navigation_url"
]
#connection: "mysql"
#table: null
#primaryKey: "id"
#keyType: "int"
+incrementing: true
#with: []
#withCount: []
#perPage: 15
+exists: true
+wasRecentlyCreated: false
#attributes: array:15 [▼
"id" => 18
"name" => ""
"slug" => ""
"image" => "201809060635_Ibe24C5RQzyozxGLcJ7z.jpg"
"icon" => "201809060707_sRO2KtrQaOeN5E4zPyzX.png"
"description" => null
"details" => null
"page_category_id" => 2
"section_id" => 2
"custom_template" => null
"author_id" => 1
"updater_id" => 1
"publish" => 1
"created_at" => "2018-01-26 09:39:49"
"updated_at" => "2018-09-06 07:43:07"
]
#original: array:15 [▼
"id" => 18
"name" => ""
"slug" => ""
"image" => "201809060635_Ibe24C5RQzyozxGLcJ7z.jpg"
"icon" => "201809060707_sRO2KtrQaOeN5E4zPyzX.png"
"description" => null
"details" => null
"page_category_id" => 2
"section_id" => 2
"custom_template" => null
"author_id" => 1
"updater_id" => 1
"publish" => 1
"created_at" => "2018-01-26 09:39:49"
"updated_at" => "2018-09-06 07:43:07"
]
#changes: []
#casts: []
#dates: []
#dateFormat: null
#dispatchesEvents: []
#observables: []
#relations: []
#touches: []
+timestamps: true
#hidden: []
#visible: []
#guarded: array:1 [▼
0 => "*"
]
#defaultLocale: null
#scoutMetadata: []
}
]
}