<commit_before><?php namespace Controllers\Admin;

use AdminController;
use Image;
use Input;
use Lang;
use Model;
use Redirect;
use Setting;
use Sentry;
use DB;
use Depreciation;
use Manufacturer;
use Str;
use Validator;
use View;

class ModelsController extends AdminController
{
    /**
     * Show a list of all the models.
     *
     * @return View
     */
    public function getIndex()
    {
        // Grab all the models
        $models = Model::orderBy('created_at', 'DESC');
        if (Input::get('Deleted')) {
        	$models->withTrashed()->Deleted();
        }
        
        $models = $models->get();

        // Show the page
        return View::make('backend/models/index', compact('models'));
    }
<commit_msg>Reduces Queries on Model Index View<commit_after><?php namespace Controllers\Admin;

use AdminController;
use Image;
use Input;
use Lang;
use Model;
use Redirect;
use Setting;
use Sentry;
use DB;
use Depreciation;
use Manufacturer;
use Str;
use Validator;
use View;

class ModelsController extends AdminController
{
    /**
     * Show a list of all the models.
     *
     * @return View
     */
    public function getIndex()
    {
        // Grab all the models
        $models = Model::orderBy('created_at', 'DESC');
        if (Input::get('Deleted')) {
        	$models->withTrashed()->Deleted();
        }
        
        $models = $models->with('category','assets','depreciation')->get();

        // Show the page
        return View::make('backend/models/index', compact('models'));
    }

{'fraction_non_alphanumeric': 0.1303780964797914, 'fraction_numerical': 0.0, 'mean_word_length': 2.6810551558753, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 10, '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': '2389603', 'n_tokens_mistral': 452, 'n_tokens_neox': 454, 'n_words': 135}