<commit_before><?php
namespace App\Models;

use App\Helpers\Helper;
use App\Models\Traits\Searchable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Lang;
use Illuminate\Database\Eloquent\SoftDeletes;
use Watson\Validating\ValidatingTrait;

/**
 * Model for Asset Maintenances.
 *
 * @version    v1.0
 */
class AssetMaintenance extends Model implements ICompanyableChild
{
    use SoftDeletes;
    use CompanyableChildTrait;
    use ValidatingTrait;


    protected $dates = [ 'deleted_at', 'start_date' , 'completion_date'];
    protected $table = 'asset_maintenances';
    // Declaring rules for form validation
    protected $rules = [
        'asset_id'               => 'required|integer',
        'supplier_id'            => 'required|integer',
        'asset_maintenance_type' => 'required',
        'title'                  => 'required|max:100',
        'is_warranty'            => 'boolean',
        'start_date'             => 'required|date_format:"Y-m-d"',
        'completion_date'        => 'nullable|date_format:"Y-m-d"',
        'notes'                  => 'string|nullable',
        'cost'                   => 'numeric|nullable'
    ];

    use Searchable;
    
    /**
     * The attributes that should be included when searching the model.
     * 
     * @var array
     */
    protected $searchableAttributes = ['title', 'notes', 'asset_maintenance_type', 'cost', 'start_date', 'completion_date'];

    /**
     * The relations and their attributes that should be included when searching the model.
     * 
     * @var array
     */
    protected $searchableRelations = []; 


    public function getCompanyableParents()
    {
        return [ 'asset' ];
    }<commit_msg>Fixed #5895 - wrong date validation in maintenances<commit_after><?php
namespace App\Models;

use App\Helpers\Helper;
use App\Models\Traits\Searchable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Lang;
use Illuminate\Database\Eloquent\SoftDeletes;
use Watson\Validating\ValidatingTrait;

/**
 * Model for Asset Maintenances.
 *
 * @version    v1.0
 */
class AssetMaintenance extends Model implements ICompanyableChild
{
    use SoftDeletes;
    use CompanyableChildTrait;
    use ValidatingTrait;


    protected $dates = [ 'deleted_at', 'start_date' , 'completion_date'];
    protected $table = 'asset_maintenances';
    // Declaring rules for form validation
    protected $rules = [
        'asset_id'               => 'required|integer',
        'supplier_id'            => 'required|integer',
        'asset_maintenance_type' => 'required',
        'title'                  => 'required|max:100',
        'is_warranty'            => 'boolean',
        'start_date'             => 'required|date',
        'completion_date'        => 'nullable|date',
        'notes'                  => 'string|nullable',
        'cost'                   => 'numeric|nullable'
    ];

    use Searchable;
    
    /**
     * The attributes that should be included when searching the model.
     * 
     * @var array
     */
    protected $searchableAttributes = ['title', 'notes', 'asset_maintenance_type', 'cost', 'start_date', 'completion_date'];

    /**
     * The relations and their attributes that should be included when searching the model.
     * 
     * @var array
     */
    protected $searchableRelations = []; 


    public function getCompanyableParents()
    {
        return [ 'asset' ];
    }
{'fraction_non_alphanumeric': 0.1173054587688734, 'fraction_numerical': 0.0040650406504065045, 'mean_word_length': 2.455366098294885, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 21, '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': '6320869', 'n_tokens_mistral': 1008, 'n_tokens_neox': 988, 'n_words': 226}