Package Data | |
---|---|
Maintainer Username: | sjdaws |
Maintainer Contact: | scott@josc.com.au (Scott Dawson) |
Package Create Date: | 2014-04-02 |
Package Last Update: | 2015-03-01 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-11 15:13:06 |
Package Statistics | |
---|---|
Total Downloads: | 15,199 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 44 |
Total Watchers: | 3 |
Total Forks: | 5 |
Total Open Issues: | 0 |
Extended functionality for Eloquent in Laravel 4 and 5.
Some parts of Vocal are based on Ardent for Laravel 4 by Max Ehsan.
Copyright (c) 2014-2015 Scott Dawson.
Vocal makes working with nested relationships easier. This is especially helpful if you're displaying multiple models to a user at once, such as a user profile with an address book, and want them to be able to change their name and update their address in one go.
The first thing you need to do is add sjdaws/vocal
as a requirement to composer.json
:
{
"require": {
"sjdaws/vocal": "2.0.*"
}
}
Update your packages with composer update
and you're ready to go.
Vocal extends the Eloquent base class, so your models are still fully compatible with Eloquent. Vocal simply intercepts some methods such as validate
and save
before they're passed to Eloquent.
To create a new Vocal model, simply make your model class extend the Vocal base class:
use Sjdaws\Vocal\Vocal;
class User extends Vocal {}
There is no need to add any Facades or Service Providers.
Vocal provides several settings and methods:
Variable | Access Modifier | Type
-----|-----|-----
$allowHydrationFromInput
| protected | boolean
$hashable
| protected | array
$languageFolder
| protected | string
$languageKey
| protected | string
$messages
| protected | array
$rules
| public | array
$validateBeforeSave
| protected | boolean
Method | Parameters
-----|-----
create | $data
, $rules
, $messages
forceCreate | $data
forceSave | $data
forceSaveAndDelete | $data
forceSaveRecursive | $data
getErrors | $filter
getErrorBag |
hydrateModel | $data
save | $data
, $rules
, $messages
saveAndDelete | $data
, $rules
, $messages
saveRecursive | $data
, $rules
, $messages
timestamp | $value
validate | $data
, $rules
, $messages
validateRecursive | $data
, $rules
, $messages