<commit_before><?php

namespace App;

use Carbon\Carbon;
use App\Traits\SupportsUuid;
use Illuminate\Database\Eloquent\Model;

class Resource extends Model {

    use SupportsUuid;

    /**
     * {@inheritDoc}
     */
    public $incrementing = false;

    /**
     * {@inheritDoc}
     */
    protected $fillable = ['name', 'type'];

    /**
     * Get resource with records from date range.
     *
     * @param  Carbon $startDate
     * @param  Carbon $endDate
     * @return static|null
     */
    public function withRecordsWithinDateRange(Carbon $startDate, Carbon $endDate)
    {
        return $this->whereId($this->id)->with(['records' => function ($record) use ($startDate, $endDate) {
            $record->where('created_at', '>=', $startDate)
                   ->where('created_at', '<=', $endDate)
                   ->orderBy('created_at', 'desc');
        }])->first();
    }

    /**
     * Save a resource record
     */
    public function generateNewRecord()<commit_msg>restricted records to 9am to 5:30pm<commit_after><?php

namespace App;

use Carbon\Carbon;
use App\Traits\SupportsUuid;
use Illuminate\Database\Eloquent\Model;

class Resource extends Model {

    use SupportsUuid;

    /**
     * {@inheritDoc}
     */
    public $incrementing = false;

    /**
     * {@inheritDoc}
     */
    protected $fillable = ['name', 'type'];

    /**
     * Get resource with records from date range.
     *
     * @param  Carbon $startDate
     * @param  Carbon $endDate
     * @return static|null
     */
    public function withRecordsWithinDateRange(Carbon $startDate, Carbon $endDate)
    {
        return $this->whereId($this->id)->with(['records' => function ($record) use ($startDate, $endDate) {
            $record->whereBetween('created_at', [$startDate->toDateString(), $endDate->toDateString()])
                    ->whereRaw('TIME(created_at) >= ?', ['09:00:00'])
                    ->whereRaw('TIME(created_at) <= ?', ['17:30:00'])
                   ->orderBy('created_at', 'desc');
        }])->first();
    }

    /**
     * Save a resource record
     */
    public function generateNewRecord()
{'fraction_non_alphanumeric': 0.15510777881911902, 'fraction_numerical': 0.007497656982193065, 'mean_word_length': 2.4491114701130856, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 24, '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': '5475294', 'n_tokens_mistral': 673, 'n_tokens_neox': 644, 'n_words': 139}