Skip to content

Commit 87a0f9e

Browse files
committed
Advanced language support
1 parent 8909c0c commit 87a0f9e

File tree

4 files changed

+17
-7
lines changed

4 files changed

+17
-7
lines changed

composer.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@
4444
}
4545
},
4646
"config": {
47-
"sort-packages": true
47+
"sort-packages": true,
48+
"platform": {
49+
"php": "7.1"
50+
}
4851
}
4952
}

readme.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
composer require korridor/laravel-model-validation-rules
77
```
88

9+
```bash
10+
php artisan vendor:publish --provider="Korridor\LaravelModelValidationRules\ModelValidationServiceProvider"
11+
```
12+
913
## Usage
1014

1115
```php

src/ModelValidationServiceProvider.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ public function register()
2121
*/
2222
public function boot()
2323
{
24-
$this->loadTranslationsFrom(__DIR__.'/../resources/lang/', 'validationRules');
24+
$this->publishes([
25+
__DIR__.'/../resources/lang' => resource_path('lang/vendor/modelValidationRules'),
26+
]);
27+
$this->loadTranslationsFrom(__DIR__.'/../resources/lang/', 'modelValidationRules');
2528
}
2629
}

src/Rules/ExistEloquent.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,10 @@ public function passes($attribute, $value): bool
8080
*/
8181
public function message(): string
8282
{
83-
return trans('validation.exist_model', [
84-
'attribute' => $this->attribute,
85-
'model' => class_basename($this->model),
86-
'value' => $this->value,
87-
]);
83+
return trans('modelValidationRules::validation.exist_model', [
84+
'attribute' => $this->attribute,
85+
'model' => class_basename($this->model),
86+
'value' => $this->value,
87+
]);
8888
}
8989
}

0 commit comments

Comments
 (0)