Skip to content

Commit

Permalink
Change details in README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
rougin committed Sep 30, 2024
1 parent 8ac0d7f commit 8507c78
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ $users = $wildfire->result('User');

## Properties of `Model` class

The `Model` class provides the following properties that helps writing clean code and the said properties also conforms to the properties based on `Eloquent ORM`.

### Casting attributes

Updating the `$casts` property allows the model to cast native types to the specified attributes:
Expand Down Expand Up @@ -280,7 +282,7 @@ class User extends \Rougin\Wildfire\Model
}
```

When enabled, it will populate the fields of `CREATED_AT` and `UPDATED_AT` constants with timestamps. To modify the names specified in the specified timestamps, kindly create specified constants to the model (e.g., `User`):
When enabled, it will populate the fields of `CREATED_AT` and `UPDATED_AT` constants with timestamps. To modify the names specified in the specified timestamps, kindly create the specified constants to the model (e.g., `User`):

``` php
// application/models/User.php
Expand All @@ -304,7 +306,7 @@ class User extends \Rougin\Wildfire\Model
```

> [!NOTE]
> Auto-populating of timestamps in the specified constants is only available when `WritableTrait` is used.
> Auto-populating of timestamps in the specified constants is also used in the `WritableTrait`.
## Using Traits

Expand Down Expand Up @@ -351,7 +353,7 @@ The `$result[0]` returns the computed offset while `$result[1]` returns the gene
<?php echo $links; ?>
```

To configure the pagination library, the `$page` property must be defined in the `Model`:
To configure the pagination library, the `$pagee` property must be defined in the `Model`:

``` php
// application/models/User.php
Expand Down Expand Up @@ -380,6 +382,9 @@ class User extends \Rougin\Wildfire\Model
}
```

> [!NOTE]
> Please see the documentation of [Pagination Class](https://codeigniter.com/userguide3/libraries/pagination.html#customizing-the-pagination) to get the list of its available configuration.
### `ValidateTrait`

This trait is used to simplify the specifying of validation rules to a model:
Expand Down Expand Up @@ -424,6 +429,9 @@ class User extends \Rougin\Wildfire\Model
}
```

> [!NOTE]
> Kindly check [its documentation](https://codeigniter.com/userguide3/libraries/form_validation.html#setting-rules-using-an-array) for the available rules that can be used to the `Form Validation` class.
To do a form validation, the `validate` method must be called from the model:

``` php
Expand Down

0 comments on commit 8507c78

Please sign in to comment.