problem with gridviews button delete this with problem in post

0

Good afternoon, I'm having trouble changing my grid views. This is

old gridviews:

 <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],

            'emp_id',
            'empCid.cid_nome',
            'emp_cnpj',
            'emp_razao_social',
            'emp_nome_fantasia',
            //'emp_logradouro',
            //'emp_numero',
            //'emp_complemento',
            //'emp_bairro',
            //'emp_cep',
            'emp_telefone',
            //'emp_email:email',
            //'emp_site',

            ['class' => 'yii\grid\ActionColumn'],
        ],
    ]); ?>
    <?php Pjax::end(); ?>
</div>

and I started using this:

<?php 

$empresas = Empresa::find()->orderBy('emp_id')->all();

?>

<div class="unit w-2-3"><div class="hero-callout">
    <table id="example" class="display">
        <thead>
            <tr>
                <th>Nome Fantasia</th>
                <th>CNPJ</th>
                <th>Razão social</th>
                <th>Cidade</th>
                <th>Telefone</th>
                <th></th>
            </tr>
        </thead>
        <tbody>
        <?php foreach($empresas as $indice => $empresa):?>
            <tr>

                <td><?= $empresa->emp_nome_fantasia ?></td>
                <td><?= $empresa->emp_cnpj ?></td>
                <td><?= $empresa->emp_razao_social ?></td>
                <td><?= $empresa->empCid->cid_nome  ?></td>
                <td><?= $empresa->emp_telefone ?></td>
                <td>
                    <a href="/gerencial/empresa/view?id=<?= $empresa->emp_id?>">
                        <span class="glyphicon glyphicon-eye-open"></span>                      
                    </a>
                    <a href="/gerencial/empresa/update?id=<?= $empresa->emp_id?>">
                        <span class="glyphicon glyphicon-pencil"></span>
                    </a>
                    <?= Html::a('<span class="glyphicon glyphicon-trash"></span>',['/gerencial/empresa/delete', 'id' => $empresa->emp_id],
                        [
                            'data' => [
                                'method' => 'POST', 
                                'confirm' => 'Você tem certeza que deseja excluir?'
                            ]
                        ]

                );?>

                </td>
            </tr>
            <?php endforeach?>
        </tbody>
    </table>
</div>

It has a delete button that in the first gridview it works quietly and in the second it gives the following error Method Not Allowed (# 405) Method Not Allowed. This URL can only handle the following request methods: POST. and I can not.

If someone can fix me I would be very grateful

    
asked by anonymous 01.11.2018 / 18:11

0 answers