From 33139849ceaa3a0b35c9564949b9942ebfa3c75e Mon Sep 17 00:00:00 2001 From: Filippo Date: Sun, 28 Jul 2019 18:26:08 +0200 Subject: [PATCH] fixed error in readme example --- readme.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/readme.md b/readme.md index 150f3c6..20a6bd0 100644 --- a/readme.md +++ b/readme.md @@ -21,7 +21,7 @@ composer require biscofil/laravel-submodels id: 1, first_name: "something", last_name: "something" - is_admin: false, + is_admin: true, admin_parameter: "something" >>> User::find(2) @@ -29,11 +29,11 @@ composer require biscofil/laravel-submodels id: 2, first_name: "something", last_name: "something", - is_admin: true -``` - + is_admin: false +``` + In order to accomplish this result, each Model that has to be extended must implement `getSubModelClass` that returns the right class depeding on conditions. - + ``` php class User extends Authenticatable{ @@ -61,7 +61,7 @@ class User extends Authenticatable{ } return $class; } - + /** * @param $query * @return mixed @@ -72,10 +72,10 @@ class User extends Authenticatable{ } } -``` - +``` + On the other side, each sub model can implement `getAppendedFillable` that returns the list of fillable parameters. This list will be merged with the list of the parent class. - + ``` php class AdminUser extends User{