custom query function laravel
<p>I often need to perform this query:</p>

<pre><code>$Op = JobCardOp::where([
        ['JobCardNum', '=', $JobCardNum ],
        ['OpNum', '=', $OpNum ]
        ])-&gt;first();
</code></pre>

<p>So rather than writing this out every time I want a function like:</p>

<pre><code> public function getOp($JobCardNum, $OpNum)
{
    $Op = JobCardOp::where([
        ['JobCardNum', '=', $JobCardNum ],
        ['OpNum', '=', $OpNum ]
        ])-&gt;first();
    return $Op;
}
</code></pre>

<p>That I can call in my controller. Where should I define my function, at the moment the I only need it in one controller but I may need it an another if thats possible. Any help appreciated.</p>