Skip to content
This repository has been archived by the owner on Oct 20, 2020. It is now read-only.

Commit

Permalink
fixed error in readme example
Browse files Browse the repository at this point in the history
  • Loading branch information
biscofil committed Jul 28, 2019
1 parent 7adecff commit 3313984
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@ 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)
=> App\User {#3164
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{

Expand Down Expand Up @@ -61,7 +61,7 @@ class User extends Authenticatable{
}
return $class;
}

/**
* @param $query
* @return mixed
Expand All @@ -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{

Expand Down

0 comments on commit 3313984

Please sign in to comment.