<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>keigo-u</author_name>
  <author_url>https://blog.hatena.ne.jp/keigo-u/</author_url>
  <blog_title>keigo-uの備忘録</blog_title>
  <blog_url>https://keigo-u.hatenablog.com/</blog_url>
  <categories>
    <anon>Laravel</anon>
  </categories>
  <description>概要 Laravelアプリケーションにおいて、検索機能等を実装する際にリレーション先も含めてOR(または)で絞り込みを行う方法をまとめる。 環境 Laravel 9 方法 orWhereHas()を使用する。 $qury-&gt;where('title', '%{$keyword}%') // 通常の絞り込み -&gt;orWhere('body', '%{$keyword}%') // 通常のOR絞り込み // 第2引数にリレーション先の絞り込み条件を指定するクロージャーを取る -&gt;orWhereHas('categories', function($q) use ($keyword) { $q-&gt;w…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fkeigo-u.hatenablog.com%2Fentry%2F2023%2F10%2F28%2F205708&quot; title=&quot;リレーション先も含めてOR絞り込みをする - keigo-uの備忘録&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2023-10-28 20:57:08</published>
  <title>リレーション先も含めてOR絞り込みをする</title>
  <type>rich</type>
  <url>https://keigo-u.hatenablog.com/entry/2023/10/28/205708</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
