ホームページ >バックエンド開発 >PHPチュートリアル >Laravel ORM を使用するときに問題がありますか?
<code class="language-php"><span class="cp"><?php</span>
<span class="k">namespace</span> <span class="nx">App\Models</span><span class="p">;</span>
<span class="k">use</span> <span class="nx">Illuminate\Database\Eloquent\Model</span><span class="p">;</span>
<span class="k">class</span> <span class="nc">User</span> <span class="k">extends</span> <span class="nx">Model</span>
<span class="p">{</span>
<span class="k">public</span> <span class="k">function</span> <span class="nf">cars</span><span class="p">()</span>
<span class="p">{</span>
<span class="k">return</span> <span class="nv">$this</span><span class="o">-></span><span class="na">hasMany</span><span class="p">(</span><span class="nx">Car</span><span class="o">::</span><span class="na">class</span><span class="p">);</span>
<span class="p">}</span>
<span class="p">}</span>
</code>
なんと...