Welcome Guest, Not a member yet? Register   Sign In
Load Dynamic Model
#4

(This post was last modified: 02-13-2020, 04:45 PM by lahoussaine.)

finally i found a solution for this problem
we have to must declare the full namespace path of a class

Code:
namespace App\Models
use App\Models\MyModel
...
case 1 :
$mymodule = new MyModel(); // work fine

case 2 :
$module = "MyModel";
$mymodule = new $module();  // Error not found

case 3:
$module = "App\\Models\\MyModel";
$mymodule = new $module();              // work fine

for help 
 
thx
Reply


Messages In This Thread
Load Dynamic Model - by lahoussaine - 02-13-2020, 11:41 AM
RE: Load Dynamic Model - by falko - 02-13-2020, 01:49 PM
RE: Load Dynamic Model - by lahoussaine - 02-13-2020, 04:22 PM
RE: Load Dynamic Model - by lahoussaine - 02-13-2020, 04:43 PM
RE: Load Dynamic Model - by swapnil0804 - 09-18-2022, 09:38 PM



Theme © iAndrew 2016 - Forum software by © MyBB