Welcome Guest, Not a member yet? Register   Sign In
Routes 4.0.0-beta.2
#4

I solved it this way:
1) I created a table where I store the routes.
2) I created the "RouteModel" model
3) I created the Config\[environment]\Routes.php file with this content

Code:
<?php namespace Config;

use App\Models\RouteModel;
$model = new RouteModel();

$db = Database::connect();
$result = $model->getAll($db);
$db->close();
if( empty($result->getResult()) == false) {
   foreach ($result->getResult() as $row) {
       $routes->add($row->from, $row->to);
   }
}

It will not be the optimal and clean solution, but it has solved my problem.
I hope it can help you in some way ...
Codeigniter 4 - Docker Image [github] [docker hub]
Reply


Messages In This Thread
Routes 4.0.0-beta.2 - by tony.a - 04-30-2019, 03:52 PM
RE: Routes 4.0.0-beta.2 - by MGatner - 05-01-2019, 04:24 AM
RE: Routes 4.0.0-beta.2 - by kilishan - 05-01-2019, 06:47 AM
RE: Routes 4.0.0-beta.2 - by atsanna - 05-01-2019, 11:15 AM
RE: Routes 4.0.0-beta.2 - by tony.a - 05-04-2019, 11:46 PM



Theme © iAndrew 2016 - Forum software by © MyBB