Hi,
primary keys in my Portfolio table are strings, so to work with prettyUrls i’ve made rules:
'urlManager' => [
'class' => 'yii\web\UrlManager',
'showScriptName' => false,
'enablePrettyUrl' => true,
'rules' => array(
'<controller:(portfolio)>/<action:(create|index)>' => '<controller>/<action>',
'<controller:(portfolio)>/<action:(update|delete)>/<id:\w+>' => '<controller>/<action>',
'<controller:(portfolio)>/<id:\w+>' => '<controller>/view',
'<controller:\w+>/<id:\d+>' => '<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
'<controller:\w+>/<action:\w+>' => '<controller>/<action>',
),
],
is there any better solution to write this rules? F.e. can I some how add only the 3rd rule with negation for create,update,index,delete?
Something like:
'<controller:(portfolio)>/<id:!(create|update|delete|index)>' => '<controller>/view',
I’ve tried ‘^’ instead of ‘!’ but without success.