Current File : /home/tradevaly/demo.tradevaly.com.bd/app/Rules/Required.php |
<?php
namespace App\Rules;
use Illuminate\Contracts\Validation\Rule;
use Cookie;
class Required implements Rule
{
/**
* Create a new rule instance.
*
* @return void
*/
private $tableModelName;
private $fieldLabelTextEn;
private $fieldLabelTextBn;
private $columnName;
private $editId;
public function __construct($fieldLabelTextEn, $fieldLabelTextBn)
{
//dd($editId);
$this->fieldLabelTextEn = $fieldLabelTextEn;
$this->fieldLabelTextBn = $fieldLabelTextBn;
}
/**
* Determine if the validation rule passes.
*
* @param string $attribute
* @param mixed $value
* @return bool
*/
public function passes($attribute, $value)
{
if( empty($value)){
return false;
}
return true;
}
/**
* Get the validation error message.
*
* @return string
*/
public function message()
{
//$langId = Cookie::get('langId');
$langId = 1;
$msg = '';
if($langId ==1){
$msg = 'The '. $this->fieldLabelTextEn.' field is required.';
}else{
$msg = $this->fieldLabelTextBn.' ফিল্ড অবশ্যয় পূরণ করতে হবে ।';
}
return $msg;
}
}