Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
MissingModelPropertyException
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5namespace DevToolbelt\LaravelEloquentPlus\Exceptions;
6
7/**
8 * Exception thrown when a required model property is missing.
9 *
10 * @package DevToolbelt\LaravelEloquentPlus\Exceptions
11 */
12class MissingModelPropertyException extends LaravelEloquentPlusException
13{
14    /**
15     * Create a new MissingModelPropertyException instance.
16     *
17     * @param string $modelClass The model class name
18     * @param string $propertyName The missing property name
19     */
20    public function __construct(string $modelClass, string $propertyName)
21    {
22        $message = 'The property "%s" is required in model "%s". '
23            . 'Please, add this column in your table and the property in the fillable attribute in your model.';
24
25        parent::__construct(sprintf($message, $propertyName, $modelClass));
26    }
27}