title: Laravel BadMethodCallException Method confirmed (query scope) does not exist in Macroable.php (line 74)
body: <p><strong>This is my model:</strong></p>
  
  <pre><code>&lt;?php
  
  namespace App;
  
  use Illuminate\Database\Eloquent\Model;
  
  
  class Jadwal extends Model
  {
  
      protected $fillable = ['ruang_id', 'tanggal', 'sesi_id', 'acara', 'user_id', 'pj_nama', 'pj_id', 'keterangan', 'alat', 'status'];
  
  
      public function ruang()
      {
          return $this-&gt;belongsTo('App\Ruang');
      }
  
      public function sesi()
      {
          return $this-&gt;belongsTo('App\Sesi');
      }
  
      public function user()
      {
          return $this-&gt;belongsTo('App\User');
      }
  
      public function scopeBook($query)
      {
          return $query-&gt;where('status', 0);
      }
  
      public function scopeConfirmed($query)
      {
         return $query-&gt;where('status', 1);
      }
  }
  </code></pre>
  
  <p><strong>This is my view with the script:</strong></p>
  
  <pre><code>@extends('layouts.app')
  
  @section('content')
    &lt;div class="container"&gt;
      &lt;div class="row"&gt;
        &lt;div class="col-md-12"&gt;
          &lt;div class="panel panel-default"&gt;
            &lt;div class="panel-heading"&gt;
              &lt;h2 class="panel-title"&gt;Daftar Jadwal Ruang&lt;/h2&gt;
            &lt;/div&gt;
  
            &lt;div class="panel-body"&gt;
              {!! $html-&gt;table(['class'=&gt;'table-striped']) !!}
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  @endsection
  
  @section('scripts')
    {!! $html-&gt;scripts() !!}
    &lt;script&gt;
      $(function() {
        $('\
          &lt;div id="filter_stat" class="dataTables_length" style="display: inline-block; margin-left:10px;"&gt;\
            &lt;label&gt;Status \
            &lt;select size="1" name="filter_stat" aria-controls="filter_stat" \
              class="form-control input-sm" style="width: 140px;"&gt;\
                &lt;option value="all" selected="selected"&gt;Semua&lt;/option&gt;\
                &lt;option value="booking"&gt;Booking&lt;/option&gt;\
                &lt;option value="confirmed"&gt;Confirmed&lt;/option&gt;\
              &lt;/select&gt;\
            &lt;/label&gt;\
          &lt;/div&gt;\
        ').insertAfter('.dataTables_length');
  
        $("#dataTableBuilder").on('preXhr.dt', function(e, settings, data) {
          data.stat = $('select[name="filter_stat"]').val();
        });
  
        $('select[name="filter_stat"]').change(function() {
          window.LaravelDataTables["dataTableBuilder"].ajax.reload();
        });
      });
    &lt;/script&gt;
  @endsection
  </code></pre>
  
  <p><strong>And this is my Controller:</strong></p>
  
  <pre><code>public function index(Request $request, Builder $htmlBuilder)
      {
          if ($request-&gt;ajax()) {
              $jadwals = Jadwal::with('ruang', 'sesi', 'user')-&gt;get();
              if ($request-&gt;get('stat') == 'booking') $jadwals-&gt;book();
              if ($request-&gt;get('stat') == 'confirmed') $jadwals-&gt;confirmed();
              return Datatables::of($jadwals)-&gt;make(true);
          }
          $html = $htmlBuilder
          -&gt;addColumn(['data' =&gt; 'ruang.nama', 'nama'=&gt;'ruang.nama', 'title'=&gt;'Ruang'])
          -&gt;addColumn(['data' =&gt; 'tanggal', 'nama'=&gt;'tanggal', 'title'=&gt;'Tanggal'])
          -&gt;addColumn(['data' =&gt; 'sesi.nama', 'nama'=&gt;'sesi.nama', 'title'=&gt;'Sesi'])
          -&gt;addColumn(['data' =&gt; 'acara', 'nama'=&gt;'acara', 'title'=&gt;'Acara'])
          -&gt;addColumn(['data' =&gt; 'user.name', 'nama'=&gt;'user.name', 'title'=&gt;'Pengguna'])
          -&gt;addColumn(['data' =&gt; 'status', 'nama'=&gt;'status', 'title'=&gt;'Status']);
          return view('guests.index')-&gt;with(compact('html'));
      }
  </code></pre>
  
  <blockquote>
    <p>When I test the method on tinker. That is work! But when I execute it
    on browser, method 'confirmed' does not exist.</p>
  </blockquote>
  
  <pre><code>PS C:\xampp\htdocs\RoomScheduling&gt; php artisan tinker
  Psy Shell v0.8.10 (PHP 7.0.5 ÔÇö cli) by Justin Hileman
  &gt;&gt;&gt; App\Jadwal::confirmed()-&gt;get();
  =&gt; Illuminate\Database\Eloquent\Collection {#865
       all: [
         App\Jadwal {#867
           id: 2,
           ruang_id: 2,
           tanggal: "2017-07-31",
           sesi_id: 1,
           acara: "Seminar",
           user_id: 10,
           pj_nama: "Hanafi",
           pj_id: "2016",
           foto_identitas: "cf7d249c202edd43b5b0424722f847b4.png",
           keterangan: "Mohon ijinnya.",
           alat: "Mic",
           status: 1,
           created_at: "2017-07-28 17:28:13",
           updated_at: "2017-07-29 09:13:58",
         },
       ],
     }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/iPZUH.png" rel="nofollow noreferrer">Error BadMethodCallException</a></p>
  
  <blockquote>
    <p>Please help me. What should I do?</p>
  </blockquote>