Welcome Guest, Not a member yet? Register   Sign In
Routing problem
#1

(This post was last modified: 01-17-2019, 07:18 AM by snelledre.)

I have a problem with the routing that's mean the delete method.

In the app/routes.php i have :
PHP Code:
$routes->resource('department'); 

The documentatie says:
PHP Code:
$routes->resource('photos');

// Equivalent to the following:
$routes->get('photos'                'Photos::index');
$routes->get('photos/new'            'Photos::new');
$routes->get('photos/(:segment)/edit''Photos::edit/$1');
$routes->get('photos/(:segment)'     'Photos::show/$1');
$routes->post('photos'               'Photos::create');
$routes->patch('photos/(:segment)'   'Photos::update/$1');
$routes->put('photos/(:segment)'     'Photos::update/$1');
$routes->delete('photos/(:segment)'  'Photos::delete/$1'); 

So if i have in my form the link to department/id like this:
PHP Code:
<?php echo form_open('department/'.$department_item['id'], 'method=delete'); ?>
    <button type="submit" class="button is-small btn-align accent-btn raised rounded btn-outlined">delete</button>
<?php echo form_close(); ?>
In the browser you see then.
Code:
<form action="http://cmms_rucphen.test/department/7" method="delete" accept-charset="utf-8">
   <button type="submit" class="button is-small btn-align accent-btn raised rounded btn-outlined">delete</button>
</form>

The link is good but when i push the button it follows not the right route.
He comes with a error but he seach for the "show"method and not the "delete" method.
In my opinion is the code alright or not?
Or is it a bug in Codeigniter 4?
If i have time tonight i will change the route to apart routes.
If that that works i will tell you.
Reply


Messages In This Thread
Routing problem - by snelledre - 01-17-2019, 06:37 AM
RE: Routing problem - by puschie - 01-17-2019, 08:21 AM
RE: Routing problem - by albertleao - 01-17-2019, 08:30 AM
RE: Routing problem - by snelledre - 01-17-2019, 10:35 AM
RE: Routing problem - by kilishan - 01-17-2019, 08:35 PM
RE: Routing problem - by snelledre - 01-18-2019, 12:37 AM



Theme © iAndrew 2016 - Forum software by © MyBB