title: get data from model with condition laravel 5.7
body: <p>I have <strong>Users_group</strong> model in my Laravel project.</p>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>&lt;?php
  
  namespace App;
  
  use Illuminate\Notifications\Notifiable;
  use Illuminate\Database\Eloquent\Model;
  
  class Users_group extends Model
  {
      use Notifiable;
  
      protected $table = 'users_groups';
      protected $fillable = ['id', 'user_id', 'group_id', 'created_at', 'updated_at'];
  
      public function getGroupData()
      {
          return $this-&gt;hasOne('App\Group','id','group_id');
      }
  }
  </code></pre>
  
  <p>And when I want to get data from this model I use this my custom method: </p>
  
  <pre><code>$data = App\Users_group ::get();
  </code></pre>
  
  <p>It's working great</p>
  
  <p>I want to get the data from model with condition not like this: </p>
  
  <pre><code>$data = App\Users_group::where('group_id','&gt;',5)-&gt;get();
  </code></pre>
  
  <p>I need to put the condition inside the model file thats make the model return the data everytime I call <code>User_group::get()</code> return it when condition inside the model.</p>
  
  <p>Thanks! </p>