Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
IsraelOrtuno committed Sep 22, 2018
2 parents 00ae327 + 8814875 commit e2429e4
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,18 +247,20 @@ The values for the newly created or updated permalink will be extracted from:

When a permalink is binded to a model, we will guess which action it points to the `permalinkAction` method defined in our `Permalinkable` model. However, we can override this action for a certain model by just specifiying a value into the `action` column of the permalink record:

| id | slug | permalinkable_type | permalinkable_id | action
| -- | ------------- | ------------------ | ---------------- | --------------------
| 1 | israel-ortuno | App\User | 1 | OtherController@action
| id | slug | permalinkable_type | permalinkable_id | action
| -- | ------ | ------------------ | ---------------- | --------------------
| 1 | madrid | App\City | 1 | App\Http\Controllers\CityController@show

You could update your model via code as any other normal relationship, for example:

```php
$user = User::find(1);
$city = City::find(1);

$user->permalink->update(['action' => 'OtherController@action']);
$city->permalink->update(['action' => 'App\Http\Controllers\CityController@show']);
```

*NOTE:* The action namespace should always be a fully qualified name unless you are using the `aliasMap` explained below.

## Support for morphMap & aliasMap

This package provides support for `morphMap`. As you may know, Laravel ships with a `morphMap` method to where you can define a relationship "morph map" to instruct Eloquent to use a custom name for each model instead of the class name.
Expand Down

0 comments on commit e2429e4

Please sign in to comment.