Skip to content
This repository was archived by the owner on Jul 16, 2023. It is now read-only.

Commit 0644b22

Browse files
committed
Further cleaning of code examples
1 parent 6e71b8b commit 0644b22

File tree

1 file changed

+3
-18
lines changed

1 file changed

+3
-18
lines changed

README.md

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ to your database, obviously):
6161
How often do you find yourself re-creating the same boilerplate code in the applications you build? Does this typical form processing code look all too familiar to you?
6262

6363
```php
64-
Route::post('register', function () {
64+
Route::post('register', function() {
6565
$rules = array(
6666
'name' => 'required|min:3|max:80|alpha_dash',
6767
'email' => 'required|between:3,64|email|unique:users',
@@ -136,14 +136,12 @@ Ardent models use Laravel's built-in [Validator class](http://doc.laravelbook.co
136136

137137
```php
138138
class User extends \LaravelBook\Ardent\Ardent {
139-
140139
public static $rules = array(
141140
'name' => 'required|between:4,16',
142141
'email' => 'required|email',
143142
'password' => 'required|alpha_num|between:4,8|confirmed',
144143
'password_confirmation' => 'required|alpha_num|between:4,8',
145144
);
146-
147145
}
148146
```
149147

@@ -209,19 +207,15 @@ For example, you may use `beforeSave` to hash a users password:
209207

210208
```php
211209
class User extends \LaravelBook\Ardent\Ardent {
212-
213-
public function beforeSave()
214-
{
210+
public function beforeSave() {
215211
// if there's a new password, hash it
216-
if($this->isDirty('password'))
217-
{
212+
if($this->isDirty('password')) {
218213
$this->password = Hash::make($this->password);
219214
}
220215

221216
return true;
222217
//or don't return nothing, since only a boolean false will halt the operation
223218
}
224-
225219
}
226220
```
227221

@@ -250,12 +244,10 @@ Just like the Laravel Validator, Ardent lets you set custom error messages using
250244

251245
```php
252246
class User extends \LaravelBook\Ardent\Ardent {
253-
254247
public static $customMessages = array(
255248
'required' => 'The :attribute field is required.',
256249
...
257250
);
258-
259251
}
260252
```
261253

@@ -294,9 +286,7 @@ To enable the auto-hydration feature, simply set the `$autoHydrateEntityFromInpu
294286

295287
```php
296288
class User extends \LaravelBook\Ardent\Ardent {
297-
298289
public $autoHydrateEntityFromInput = true;
299-
300290
}
301291
```
302292

@@ -309,9 +299,7 @@ To enable this feature, simply set the `$autoPurgeRedundantAttributes` instance
309299

310300
```php
311301
class User extends \LaravelBook\Ardent\Ardent {
312-
313302
public $autoPurgeRedundantAttributes = true;
314-
315303
}
316304
```
317305

@@ -324,11 +312,8 @@ To do that, add the attribute name to the `Ardent::$passwordAttributes` static a
324312

325313
```php
326314
class User extends \LaravelBook\Ardent\Ardent {
327-
328315
public static $passwordAttributes = array('password');
329-
330316
public $autoHashPasswordAttributes = true;
331-
332317
}
333318
```
334319

0 commit comments

Comments
 (0)