<commit_before><?php

namespace Taskforcedev\CrudAPI\Http\Controllers;

use Illuminate\Foundation\Bus\DispatchesCommands;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Console\AppNamespaceDetectorTrait;

/**
 * Class Controller
 *
 * @package Taskforcedev\CrudAPI\Http\Controllers
 */
abstract class Controller extends BaseController
{
    use DispatchesCommands, ValidatesRequests, AppNamespaceDetectorTrait;

    /**
     * Gets the namespace of the applications models (from user config).
     * @return mixed
     */
    protected function getModelNamespace()
    {
        try {
            $ns = $this->getAppNamespace();
            return $ns;
        } catch (\Exception $e) {
            return false;
        }
    }

    /**
     * Fully qualifies the model name based on configuration.
     * @param  string $model The name of the model.
     * @return string        Fully qualified model name.
     */
    protected function qualify($model)
    {
        return $this->getModelNamespace() . '\' . $model;
    }

    /**
     * Return the model based on its name.
     * @param  string $model The name of the model.
     * @return Object        A new fully qualified model instance.
     */
    protected function getModel($model)
    {
        $model = $this->qualify($model);<commit_msg>Update Controller.php<commit_after><?php

namespace Taskforcedev\CrudAPI\Http\Controllers;

use Illuminate\Foundation\Bus\DispatchesCommands;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Console\AppNamespaceDetectorTrait;

/**
 * Class Controller
 *
 * @package Taskforcedev\CrudAPI\Http\Controllers
 */
abstract class Controller extends BaseController
{
    use DispatchesCommands, ValidatesRequests, AppNamespaceDetectorTrait;

    /**
     * Gets the namespace of the applications models (from user config).
     * @return mixed
     */
    protected function getModelNamespace()
    {
        try {
            $ns = $this->getAppNamespace();
            return $ns;
        } catch (\Exception $e) {
            return false;
        }
    }

    /**
     * Fully qualifies the model name based on configuration.
     * @param  string $model The name of the model.
     * @return string        Fully qualified model name.
     */
    protected function qualify($model)
    {
        return $this->getModelNamespace() . '\\' . $model;
    }

    /**
     * Return the model based on its name.
     * @param  string $model The name of the model.
     * @return Object        A new fully qualified model instance.
     */
    protected function getModel($model)
    {
        $model = $this->qualify($model);
{'fraction_non_alphanumeric': 0.09534127843986999, 'fraction_numerical': 0.0, 'mean_word_length': 2.5974025974025974, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '4422465', 'n_tokens_mistral': 733, 'n_tokens_neox': 758, 'n_words': 214}