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.