You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For all available methods, see the [Helpers](src/Support/Helpers.php) class.
33
43
34
-
> Custom `TranslationServiceProvider` class that adds enhanced logging for missing translations and variables, helping in debugging localization issues.
44
+
## Translation Service Provider
45
+
46
+
> Enhanced logging for missing translations and variables.
35
47
36
48
- **Missing Translation Logging**: Logs warnings when a translation key is missing.
37
49
- **Missing Variables Logging**: Logs warnings when variables required in a translation string are not provided.
38
-
-**Debug Mode Checks**: In debug mode, it checks all available locales for missing translations and variables.
50
+
- **All Locale Check**: In debug mode, it checks all available locales for missing translations and variables.
39
51
- **TranslatorException**: Throws an `InternetGuru\LaravelCommon\Exceptions\TranslatorException` exception instead of logging when the app is not in production mode.
40
52
41
-
Add the following lines to the `config/app.php` file:
53
+
Add the following lines to the `config/app.php` file to use the `TranslationServiceProvider`:
42
54
43
55
```php
44
56
use Illuminate\Support\ServiceProvider;
@@ -48,24 +60,12 @@ Add the following lines to the `config/app.php` file:
48
60
])->toArray(),
49
61
```
50
62
51
-
### Helpers
52
-
53
-
> The `Helpers` class provides useful methods for Laravel applications.
54
-
55
-
You can use the `Helpers` class methods, such as `getAppInfoArray` and `getAppInfo`, to get information about the application.
For more available methods, please refer to the `Helpers` class.
62
-
63
-
### Casts
64
-
65
-
#### Carbon Interval
63
+
## Carbon Interval Cast
66
64
67
65
> Casts a string to a `CarbonInterval` and back.
68
66
67
+
Example usage:
68
+
69
69
```php
70
70
use Illuminate\Database\Eloquent\Model;
71
71
use InternetGuru\LaravelCommon\Casts\CarbonIntervalCast;
@@ -78,31 +78,92 @@ class Task extends Model
78
78
}
79
79
```
80
80
81
-
###Blade Components
81
+
## Blade Components
82
82
83
-
#### Breadcrumb
83
+
> The package provides a set of Blade components for Laravel applications.
84
84
85
-
> Blade component that renders breadcrumb navigation.
85
+
### Breadcrumb
86
86
87
-
Key features:
88
-
- Breadcrumb items are generated from the current URL path.
89
-
- Translation support for each breadcrumb item as `navig.{segment}`.
90
-
- Short translation support for each breadcrumb item as `navig.{segment}.short`.
91
-
- Divider character can be customized, default `›`.
92
-
- Skip first N path segments option `skip-first`, default `0`. E.g. to skip the language.
87
+
> The Breadcrumb Blade component renders breadcrumb navigation in your application, helping users understand their location within the app's hierarchy.
93
88
94
-
Note: The `navig` translation file should be created in the `resources/lang/{lang}` directory.
89
+
Key Features:
90
+
91
+
-**Automatic Path Parsing**: Automatically parses the current URL and generates breadcrumb items based on your routes and translations.
92
+
-**Customizable Divider**: Allows customization of the divider symbol between breadcrumb items.
93
+
-**Localization Support**: Supports translation of breadcrumb items using Laravel's localization system.
94
+
-**Short and Long Labels**: Supports both short and long labels for breadcrumb items.
95
+
-**Segment Skipping**: Optionally skip a specified number of URL segments, useful for nested routes or prefixes.
96
+
97
+
Usage:
95
98
96
99
```html
97
-
<x-ig::breadcrumbdivider="|"skip-first="1">
100
+
<!-- By default, this will generate breadcrumb items based on the current URL path. -->
101
+
<x-ig::breadcrumb/>
102
+
<!-- You can change the divider symbol by setting the divider attribute -->
103
+
<x-ig::breadcrumbdivider="|" />
104
+
<!-- If you need to skip certain segments of the URL (e.g., an language prefix), use the skipFirst attribute -->
105
+
<x-ig::breadcrumb:skipFirst="1" />
98
106
```
99
107
100
-
#### Form components
108
+
Example:
109
+
110
+
- Assuming you have the following routes defined:
111
+
```php
112
+
<?php
113
+
Route::get('/', function () {
114
+
// ...
115
+
})->name('home');
116
+
117
+
Route::get('/products', function () {
118
+
// ...
119
+
})->name('products.index');
120
+
121
+
Route::get('/products/{product}', function ($product) {
122
+
// ...
123
+
})->name('products.show');
124
+
```
125
+
- And your translation files (resources/lang/en/navig.php) include:
126
+
```php
127
+
<?php
128
+
return [
129
+
'home' => 'Long Application Name|LAN',
130
+
'products.index' => 'All Products|Products',
131
+
'products.show' => 'Product Details',
132
+
];
133
+
```
134
+
- When you visit the `/products/123` URL, the breadcrumb will render as follows:
135
+
```
136
+
LAN > Products > Product Details
137
+
```
138
+
- When you visit the `/products` URL, the long label will be used for the `products.index` route:
139
+
```
140
+
LAN > All Products
141
+
```
142
+
- When you visit the `/` URL, the long label will be used for the `home` route:
143
+
```
144
+
Long Application Name
145
+
```
146
+
147
+
### System Messages
148
+
149
+
> The `messages` Blade component renders system success messages and errros messages.
150
+
151
+
Include the component in your Blade template where you want the system messages to appear:
152
+
153
+
```html
154
+
<x-ig::system-messages />
155
+
```
156
+
157
+
### Form Inputs
158
+
159
+
> The package provides a set of Blade components for form inputs.
160
+
161
+
Notes:
101
162
102
-
> Blade components that render form elements.
163
+
- Google Recaptcha V3 is enabled by default. To disable it, set the `recaptcha` attribute to `false`.
164
+
- You need to install the [internetguru/laravel-recaptchav3](https://github.com/internetguru/laravel-recaptchav3) package for the Recaptcha to work.
103
165
104
-
Recaptcha is enabled by default. To disable it, set the `recaptcha` attribute to `false`.
105
-
You need to install the `internetguru/laravel-recaptchav3` package for the Recaptcha to work. See the [documentation](https://github.com/internetguru/laravel-recaptchav3) for more information.
0 commit comments