xxperez / codeigniter4modular Goto Github PK
View Code? Open in Web Editor NEWModular structure examples for Codeigniter4
License: MIT License
Modular structure examples for Codeigniter4
License: MIT License
When I use the command
$ php spark db:seed Modules/Samples/Database/Seeds/00000000000001-default-admin.php
to seed the database, it does not find the seeder (root path removed):
CodeIgniter v4.1.9 Command Line Tool - Server Time: 2022-03-31 20:57:00 UTC+02:00
An uncaught Exception was encountered
Type: InvalidArgumentException
Message: The specified seeder is not a valid file: [...]/app/Database/Seeds/Modules/Samples/Database/Seeds/00000000000001-default-admin.php
Filename: [...]/vendor/codeigniter4/framework/system/Database/Seeder.php
Line Number: 132
Backtrace:
-77 - [...]/vendor/codeigniter4/framework/system/Commands/Database/Seed.php::call
-63 - [...]/vendor/codeigniter4/framework/system/CLI/Commands.php::run
-70 - [...]/vendor/codeigniter4/framework/system/CLI/CommandRunner.php::run
-56 - [...]/vendor/codeigniter4/framework/system/CLI/CommandRunner.php::index
-830 - [...]/vendor/codeigniter4/framework/system/CodeIgniter.php::_remap
-419 - [...]/vendor/codeigniter4/framework/system/CodeIgniter.php::runController
-326 - [...]/vendor/codeigniter4/framework/system/CodeIgniter.php::handleRequest
-48 - [...]/vendor/codeigniter4/framework/system/CLI/Console.php::run
-57 - [...]/spark::run
Migrations work as expected.
Relevant files (comments removed for brevity):
Modules/Samples/Database/Seeds/00000000000001-default-admin.php:
namespace NX\Samples\Database\Seeds;
use CodeIgniter\Database\Seeder;
class UserSeeder extends Seeder
{
public function run()
{
$users = [
[
'firstname' => 'Super',
'lastname' => 'Administrator',
'email' => '[email protected]',
'useralias' => 'admin',
'password' => '$2y$10$rxWAQYBSpsvDN8BGMsA6KespEub7/dT/5DQpR5IZjCjSS.ZWcoZwO',
],
];
$builder = $this->db->table('users');
foreach ($users as $user) {
$builder->insert($user);
}
}
}
app/Config/Autoload.php
namespace Config;
use CodeIgniter\Config\AutoloadConfig;
class Autoload extends AutoloadConfig
{
public $psr4 = [
APP_NAMESPACE => APPPATH, // For custom app namespace
'Config' => APPPATH . 'Config',
APP_NAMESPACE . '\\Controllers' => APPPATH . 'Controllers',
'Home' => APPPATH . '../Modules/Home',
'Users' => APPPATH . '../Modules/Users',
'Utils' => APPPATH . '../Modules/Utils',
'NX\\Samples' => APPPATH . '../Modules/Samples',
];
public $classmap = [];
}
Controller or its method is not found: \Users\Controllers\Users::login
I followed all steps and still get this error.
Any help will be much appreciated
Hello devs
config: PHP 8.3 - CI4.4.3 - debian 12.2
Error Class "Users\Validation\UserRules" not found
in app/Config/Validation.php UserRules file name is missing an "'s"
location: \Users\Validation\UserRules::class, /root/Modules/Users/Validation/UsersRules.php
FIX with \Users\Validation\UsersRules::class,
Thanks for this program
Gabriel
Accessing static trait property Utils\Libraries\UtilsResponseLib::$SUCCESS is deprecated, it should only be accessed on a class using the trait
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.