Hi, everyone!
In my model I use validation and localization of validation error message, s.e.
class Feedback extends Eloquent{
protected $table = 'feedback';
public static $rules = array(
'name' => 'required',
'email' => 'required|email',
'message' => 'required',
);
public static $messages = array(
'name.required' => trans('main.feedbackmodalbodynamerequired'),
'email.required' => trans('main.feedbackmodalbodyemailrequired'),
'email.email' => trans('main.feedbackmodalbodyemailemail'),
'message.required' => trans('main.feedbackmodalbodymessagerequired'),
);
}
But i receive FatalErrorException on 'name.required' => trans('main.feedbackmodalbodynamerequired'), and other line bellow.
What the reason of error take place? Can somebody explain to me?
I think this happens because http://www.php.net/manual/en/language.oop5.properties.php:
This declaration may include an initialization, but this initialization must be a constant value--that is, it must be able to be evaluated at compile time and must not depend on run-time information in order to be evaluated.
Is it right?
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community