<commit_before><?php namespace Bedard\Shop\Api;

use Bedard\Shop\Classes\ApiController;
use Bedard\Shop\Models\ApiSettings;
use Bedard\Shop\Repositories\ProductRepository;

class ProductsApi extends ApiController
{
    /**
     * List products.
     *
     * @return October\Rain\Database\Collection
     */
    public function index(ProductRepository $repository)
    {
        $query = input();
        $options = ApiSettings::getProductsOptions();

        if (! $options['is_enabled']) {
            return abort(403, 'Forbidden');
        }

        return $repository->get($query, $options);
    }

    /**
     * Find a product.
     *
     * @param  ProductRepository            $repository
     * @param  string                       $slug
     * @return \Bedard\Shop\Models\Product
     */
    public function show(ProductRepository $repository, $slug)
    {
        $query = input();
        $options = ApiSettings::getProductOptions();

        if (! $options['is_enabled']) {
            return abort(403, 'Forbidden');
        }

        return $repository->find($slug, $query);
    }
}<commit_msg>Pass api options to repository<commit_after><?php namespace Bedard\Shop\Api;

use Bedard\Shop\Classes\ApiController;
use Bedard\Shop\Models\ApiSettings;
use Bedard\Shop\Repositories\ProductRepository;

class ProductsApi extends ApiController
{
    /**
     * List products.
     *
     * @return October\Rain\Database\Collection
     */
    public function index(ProductRepository $repository)
    {
        $query = input();
        $options = ApiSettings::getProductsOptions();

        if (! $options['is_enabled']) {
            return abort(403, 'Forbidden');
        }

        return $repository->get($query, $options);
    }

    /**
     * Find a product.
     *
     * @param  ProductRepository            $repository
     * @param  string                       $slug
     * @return \Bedard\Shop\Models\Product
     */
    public function show(ProductRepository $repository, $slug)
    {
        $query = input();
        $options = ApiSettings::getProductOptions();

        if (! $options['is_enabled']) {
            return abort(403, 'Forbidden');
        }

        return $repository->find($slug, $query, $options);
    }
}
{'fraction_non_alphanumeric': 0.12616614837849843, 'fraction_numerical': 0.0053309640159928924, 'mean_word_length': 2.263768115942029, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6468178', 'n_tokens_mistral': 632, 'n_tokens_neox': 622, 'n_words': 127}