Help with chiliec/yii2-vote

I do the right configuration, create the migrations and when voting, the message “not found” appears and the console shows an error/vote/default/vote 404 not found, the error says something about jquery. Would you help me?

My main.config

    'bootstrap' => [
    'chiliec\vote\components\VoteBootstrap',
],
'modules' => [
    'gridview' => [
        'class' => '\kartik\grid\Module'
    ],
    'vote' => [
        'class' => 'chiliec\vote\Module',
        'popOverEnabled' => true,

        'models' => [
            1 => [
                'modelName' => \common\models\Assistencia::className(),
                'allowGuests' => true,
                'allowChangeVote' => true,
            ],
        ],
    ],
],

My view

                <div class="row">
                <div class="col-md-12">
                    <?php echo \chiliec\vote\widgets\Vote::widget([
                        'model' => $model,
                        // optional fields
                        // 'showAggregateRating' => true,
                    ]); ?>
                </div>
            </div>

Chiliec, you said it could be a problem in the controller / action, where should I change it to work, which file? and another thing, do you think it might have something to do with the behaviors that make access control? because I haven’t defined who can like or not like this part, if that’s how I add it?

sorry for so many questions.

Show url manager settings.

Here.

    'components' => [
'formatter' => [
    'class' => Formatter::class,
    'thousandSeparator' => '.',
    'decimalSeparator' => ',',
],
'cache' => [
    'class' => FileCache::class,
],
'urlManager' => [
    'enablePrettyUrl' => true,
    'showScriptName' => false,
    'enableStrictParsing' => true,
],
'hash' => [
    'class' => Hash::class,
    'salt' => 'HayrGLrgJnk26V5zHltB',
    'minHashLenght' => 6,
    'alphabet' => 'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890',
],

],

I think it’s because enableStrictParsing enabled. So you need to add vote url rule manually:

'urlManager' => [
    'enablePrettyUrl' => true,
    'showScriptName' => false,
    'enableStrictParsing' => true,
    'rules' => [
        'vote/default/vote' => 'vote', 
    ],
],
1 Like

It worked, you’re the best. thank you very much