<?xml version='1.0' encoding="utf-8"?>
      <rss version='2.0'>
      <channel>
      <title>Форум на Исходниках.RU</title>
      <link>https://forum.sources.ru</link>
      <description>Форум на Исходниках.RU</description>
      <generator>Форум на Исходниках.RU</generator>
  	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=432440&amp;view=findpost&amp;p=3884987</guid>
        <pubDate>Mon, 16 Jan 2023 10:29:00 +0000</pubDate>
        <title>Laravel 8: Отношения моделей вместо построителя запросов</title>
        <link>https://forum.sources.ru/index.php?showtopic=432440&amp;view=findpost&amp;p=3884987</link>
        <description><![CDATA[Majestio: Здравствуйте&#33;<br>
<br>
Появился вопрос, может быть поможете ... Я написал работающий код:<br>
<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">$id = Auth::User()-&#62;id;</div><div class="code_line">$orderCount = DB::table(&#39;orders&#39;)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;-&#62;join(&#39;order_products&#39;, &#39;order.id&#39;, &#39;=&#39;, &#39;order_products.order_id&#39;)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;-&#62;where(&#39;status&#39;, &#39;=&#39;, 0)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;-&#62;where(&#39;user_id&#39;, &#39;=&#39;, $id)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;-&#62;count();</div></ol></div></div></div></div><script>preloadCodeButtons('1');</script><br>
Можно ли как-то вместо построителя запросов относительно таблиц - написать тоже самое, но через отношение моделей? <br>
Вообще возможно ли такое? В смысле - чтобы имена таблиц тут не светились в явном виде.]]></description>
        <author>Majestio</author>
        <category>WWW - Готовые движки</category>
      </item>
	
      </channel>
      </rss>
	