Skip to content

Commit

Permalink
Merge pull request #4073 from kenjis/fix-models-indent
Browse files Browse the repository at this point in the history
docs: fix models indentation
  • Loading branch information
paulbalandan authored Jan 7, 2021
2 parents 83e44c6 + e0bb7a7 commit 1cc2c83
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions user_guide_src/source/models/entities.rst
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,8 @@ the value whenever the property is set::
{
protected $casts = [
'options' => 'array',
'options_object' => 'json',
'options_array' => 'json-array',
'options_object' => 'json',
'options_array' => 'json-array',
];
}

Expand Down
30 changes: 15 additions & 15 deletions user_guide_src/source/models/model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -674,12 +674,12 @@ Working With Query Builder
You can get access to a shared instance of the Query Builder for that model's database connection any time you
need it::

$builder = $userModel->builder();
$builder = $userModel->builder();

This builder is already set up with the model's $table. If you need access to another table
you can pass it in as a parameter, but be aware that this will not return a shared instance::

$groupBuilder = $userModel->builder('groups');
$groupBuilder = $userModel->builder('groups');

You can also use Query Builder methods and the Model's CRUD methods in the same chained call, allowing for
very elegant use::
Expand Down Expand Up @@ -777,12 +777,12 @@ use the same callback in multiple events::

Additionally, each model may allow (default) or deny callbacks class-wide by setting its $allowCallbacks property::

protected $allowCallbacks = false;
protected $allowCallbacks = false;

You may also change this setting temporarily for a single model call sing the ``allowCallbacks()`` method::

$model->allowCallbacks(false)->find(1); // No callbacks triggered
$model->find(1); // Callbacks subject to original property value
$model->allowCallbacks(false)->find(1); // No callbacks triggered
$model->find(1); // Callbacks subject to original property value

Event Parameters
----------------
Expand Down Expand Up @@ -829,16 +829,16 @@ boolean, ``returnData``::

protected $beforeFind = ['checkCache'];
...
protected function checkCache(array $data)
{
// Check if the requested item is already in our cache
if (isset($data['id']) && $item = $this->getCachedItem($data['id']]))
{
$data['data'] = $item;
$data['returnData'] = true;

return $data;
...
protected function checkCache(array $data)
{
// Check if the requested item is already in our cache
if (isset($data['id']) && $item = $this->getCachedItem($data['id']]))
{
$data['data'] = $item;
$data['returnData'] = true;

return $data;
...

Manual Model Creation
=====================
Expand Down

0 comments on commit 1cc2c83

Please sign in to comment.