public function scopeFor($query, $table)
    {
        if ($table instanceof Model) {
            $table = $table->getTable();
        }

        return $query->where('table_name', $table);
    }
public function scopeFor($query, $table)
    {
        if ($table instanceof Model) {
            $table = $table->getTable();
        }

        return $query->where('table_name', $table);
    }
public function scopeFor ( $ query , $ table ) { if ( $ table instanceof Model ) { $ table = $ table -> getTable ( ) ; } return $ query -> where ( 'table_name' , $ table ) ; }
Query scope for.

@link https://laravel.com/docs/eloquent#local-scopes

@param \Illuminate\Database\Eloquent\Builder      $query
@param \Illuminate\Database\Eloquent\Model|string $table

@return \Illuminate\Database\Eloquent\Builder
Query scope for .