├── .env-example ├── .gitignore ├── LICENSE ├── Procfile ├── README.md ├── app ├── .htaccess ├── Commands │ └── RefreshCommand.php ├── Common.php ├── Config │ ├── App.php │ ├── Autoload.php │ ├── Boot │ │ ├── development.php │ │ ├── production.php │ │ └── testing.php │ ├── Cache.php │ ├── Constants.php │ ├── ContentSecurityPolicy.php │ ├── Cors.php │ ├── Database.php │ ├── DocTypes.php │ ├── Email.php │ ├── Encryption.php │ ├── Events.php │ ├── Exceptions.php │ ├── Filters.php │ ├── ForeignCharacters.php │ ├── Format.php │ ├── Honeypot.php │ ├── Images.php │ ├── Kint.php │ ├── Logger.php │ ├── Migrations.php │ ├── Mimes.php │ ├── Modules.php │ ├── Pager.php │ ├── Paths.php │ ├── Routes.php │ ├── Services.php │ ├── Toolbar.php │ ├── UserAgents.php │ ├── Validation.php │ └── View.php ├── Controllers │ ├── Api │ │ ├── BookApiController.php │ │ └── StatusApiController.php │ ├── BaseController.php │ ├── BookController.php │ └── Home.php ├── Criteria │ └── BookCriteria.php ├── Database │ ├── Migrations │ │ ├── .gitkeep │ │ └── 2020-01-10-112925_create_contact_table.php │ └── Seeds │ │ ├── .gitkeep │ │ └── BookSeeder.php ├── Entities │ ├── BookEntity.php │ └── StatusEntity.php ├── Filters │ └── .gitkeep ├── Helpers │ └── .gitkeep ├── Language │ ├── .gitkeep │ └── en │ │ └── Validation.php ├── Libraries │ └── .gitkeep ├── Models │ ├── .gitkeep │ ├── BookModel.php │ └── StatusModel.php ├── Repository │ ├── BookRepository.php │ └── StatusRepository.php ├── ThirdParty │ └── .gitkeep ├── Traits │ └── HashableTrait.php ├── Transformers │ ├── BaseTransformer.php │ ├── Book │ │ └── BookTransformer.php │ ├── CodeIgniterPaginatorAdapter.php │ └── Status │ │ └── StatusTransformer.php ├── Views │ ├── BookView.php │ ├── errors │ │ ├── cli │ │ │ ├── error_404.php │ │ │ ├── error_exception.php │ │ │ └── production.php │ │ └── html │ │ │ ├── debug.css │ │ │ ├── debug.js │ │ │ ├── error_404.php │ │ │ ├── error_exception.php │ │ │ └── production.php │ ├── partials │ │ └── main.php │ ├── parts │ │ └── modals.php │ └── welcome_message.php └── index.html ├── composer.json ├── composer.lock ├── contributing.md ├── license.txt ├── phpunit.xml.dist ├── public ├── .htaccess ├── 1.png ├── 2.png ├── 3.png ├── 4.png ├── favicon.ico ├── index.php ├── robots.txt ├── session │ ├── ci_session8c1grs9pv7rbtqb3as5oakipi3n42vsd │ └── ci_sessiond73p4e53t1tkac5usopmc9ktmqhgbv4q └── writeable │ └── session │ └── ci_session8c1grs9pv7rbtqb3as5oakipi3n42vsd ├── spark └── writable ├── .htaccess ├── cache └── index.html ├── logs └── index.html └── uploads └── index.html /.env-example: -------------------------------------------------------------------------------- 1 | #-------------------------------------------------------------------- 2 | # Example Environment Configuration file 3 | # 4 | # This file can be used as a starting point for your own 5 | # custom .env files, and contains most of the possible settings 6 | # available in a default install. 7 | # 8 | # By default, all of the settings are commented out. If you want 9 | # to override the setting, you must un-comment it by removing the '#' 10 | # at the beginning of the line. 11 | #-------------------------------------------------------------------- 12 | 13 | #-------------------------------------------------------------------- 14 | # ENVIRONMENT 15 | #-------------------------------------------------------------------- 16 | 17 | CI_ENVIRONMENT = development 18 | 19 | #-------------------------------------------------------------------- 20 | # APP 21 | #-------------------------------------------------------------------- 22 | 23 | #app.baseURL = 'http://crud.ci4.local' 24 | app.forceGlobalSecureRequests = false 25 | # 26 | app.sessionDriver = 'CodeIgniter\Session\Handlers\FileHandler' 27 | app.sessionCookieName = 'ci_session' 28 | # app.sessionSavePath = 'session'; 29 | app.sessionMatchIP = false 30 | app.sessionTimeToUpdate = 300 31 | app.sessionRegenerateDestroy = false 32 | 33 | # app.cookiePrefix = '' 34 | # app.cookieDomain = '' 35 | # app.cookiePath = '/' 36 | # app.cookieSecure = false 37 | # app.cookieHTTPOnly = false 38 | 39 | app.CSRFProtection = true 40 | app.CSRFTokenName = 'csrf_token_name' 41 | app.CSRFCookieName = 'csrf_cookie_name' 42 | app.CSRFExpire = 7200 43 | app.CSRFRegenerate = false 44 | app.CSRFExcludeURIs = [] 45 | 46 | # app.CSPEnabled = false 47 | 48 | #-------------------------------------------------------------------- 49 | # DATABASE 50 | #-------------------------------------------------------------------- 51 | 52 | database.default.hostname = localhost 53 | database.default.database = crud-ci4 54 | database.default.username = root 55 | database.default.password = 56 | database.default.DBDriver = MySQLi 57 | 58 | # database.tests.hostname = localhost 59 | # database.tests.database = ci4 60 | # database.tests.username = root 61 | # database.tests.password = root 62 | # database.tests.DBDriver = MySQLi 63 | 64 | #-------------------------------------------------------------------- 65 | # CONTENT SECURITY POLICY 66 | #-------------------------------------------------------------------- 67 | 68 | # contentsecuritypolicy.reportOnly = false 69 | # contentsecuritypolicy.defaultSrc = 'none' 70 | # contentsecuritypolicy.scriptSrc = 'self' 71 | # contentsecuritypolicy.styleSrc = 'self' 72 | # contentsecuritypolicy.imageSrc = 'self' 73 | # contentsecuritypolicy.base_uri = null 74 | # contentsecuritypolicy.childSrc = null 75 | # contentsecuritypolicy.connectSrc = 'self' 76 | # contentsecuritypolicy.fontSrc = null 77 | # contentsecuritypolicy.formAction = null 78 | # contentsecuritypolicy.frameAncestors = null 79 | # contentsecuritypolicy.mediaSrc = null 80 | # contentsecuritypolicy.objectSrc = null 81 | # contentsecuritypolicy.pluginTypes = null 82 | # contentsecuritypolicy.reportURI = null 83 | # contentsecuritypolicy.sandbox = false 84 | # contentsecuritypolicy.upgradeInsecureRequests = false 85 | 86 | #-------------------------------------------------------------------- 87 | # ENCRYPTION 88 | #-------------------------------------------------------------------- 89 | 90 | # encryption.key = 91 | # encryption.driver = OpenSSL 92 | 93 | #-------------------------------------------------------------------- 94 | # HONEYPOT 95 | #-------------------------------------------------------------------- 96 | 97 | # honeypot.hidden = 'true' 98 | # honeypot.label = 'Fill This Field' 99 | # honeypot.name = 'honeypot' 100 | # honeypot.template = '' 101 | # honeypot.container = '
{template}
' 102 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | #------------------------- 2 | # Operating Specific Junk Files 3 | #------------------------- 4 | 5 | # OS X 6 | .DS_Store 7 | .AppleDouble 8 | .LSOverride 9 | 10 | # OS X Thumbnails 11 | ._* 12 | 13 | # Windows image file caches 14 | Thumbs.db 15 | ehthumbs.db 16 | Desktop.ini 17 | 18 | # Recycle Bin used on file shares 19 | $RECYCLE.BIN/ 20 | 21 | # Windows Installer files 22 | *.cab 23 | *.msi 24 | *.msm 25 | *.msp 26 | 27 | # Windows shortcuts 28 | *.lnk 29 | 30 | # Linux 31 | *~ 32 | 33 | # KDE directory preferences 34 | .directory 35 | 36 | # Linux trash folder which might appear on any partition or disk 37 | .Trash-* 38 | 39 | #------------------------- 40 | # Environment Files 41 | #------------------------- 42 | # These should never be under version control, 43 | # as it poses a security risk. 44 | .env 45 | .vagrant 46 | Vagrantfile 47 | 48 | #------------------------- 49 | # Temporary Files 50 | #------------------------- 51 | writable/cache/* 52 | !writable/cache/index.html 53 | 54 | writable/logs/* 55 | !writable/logs/index.html 56 | 57 | writable/session/* 58 | !writable/session/index.html 59 | 60 | writable/uploads/* 61 | !writable/uploads/index.html 62 | 63 | writable/debugbar/* 64 | 65 | php_errors.log 66 | 67 | #------------------------- 68 | # User Guide Temp Files 69 | #------------------------- 70 | user_guide_src/build/* 71 | user_guide_src/cilexer/build/* 72 | user_guide_src/cilexer/dist/* 73 | user_guide_src/cilexer/pycilexer.egg-info/* 74 | 75 | #------------------------- 76 | # Test Files 77 | #------------------------- 78 | tests/coverage* 79 | 80 | # Don't save phpunit under version control. 81 | phpunit 82 | 83 | #------------------------- 84 | # Composer 85 | #------------------------- 86 | vendor/ 87 | # composer.lock 88 | 89 | #------------------------- 90 | # IDE / Development Files 91 | #------------------------- 92 | 93 | # Modules Testing 94 | _modules/* 95 | 96 | # phpenv local config 97 | .php-version 98 | 99 | # Jetbrains editors (PHPStorm, etc) 100 | .idea/ 101 | *.iml 102 | 103 | # Netbeans 104 | nbproject/ 105 | build/ 106 | nbbuild/ 107 | dist/ 108 | nbdist/ 109 | nbactions.xml 110 | nb-configuration.xml 111 | .nb-gradle/ 112 | 113 | # Sublime Text 114 | *.tmlanguage.cache 115 | *.tmPreferences.cache 116 | *.stTheme.cache 117 | *.sublime-workspace 118 | *.sublime-project 119 | .phpintel 120 | /api/ 121 | 122 | # Visual Studio Code 123 | .vscode/ 124 | 125 | /results/ 126 | /phpunit*.xml -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 CodeIgniter 4 web framework 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | web: vendor/bin/heroku-php-apache2 public/ -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CodeIgniter4 Ajax CRUD 2 | 3 | Program sederhana Ajax Crud dengan CodeIgniter4. 4 | 5 | # Installation 6 | ### Clone the repository: 7 | ``` 8 | git clone https://github.com/agungsugiarto/codeigniter4-ajax-crud.git 9 | ``` 10 | 11 | ### Pindah ke directory codeigniter4-ajax-crud: 12 | ``` 13 | cd odeigniter4-ajax-crud 14 | ``` 15 | 16 | ### Install dependency: 17 | ``` 18 | composer install 19 | ``` 20 | 21 | ### Buat database baru. Kemudian rename .env.example ke .env selanjutnya sesuaikan dengan konfigurasi database: 22 | ``` 23 | database.default.hostname = localhost 24 | database.default.database = crud-ci4 25 | database.default.username = root 26 | database.default.password = 27 | database.default.DBDriver = MySQLi 28 | ``` 29 | 30 | ### Migrasi database: 31 | ``` 32 | php spark migrate 33 | ``` 34 | 35 | ### Buat data dummy dengan perintah: 36 | ``` 37 | php spark db:seed BookSeeder 38 | ``` 39 | 40 | ### Jalankan aplikasi dengan perintah: 41 | ``` 42 | php spark serve 43 | ``` 44 | 45 | Sekarang buka browser dengan alamat address http://localhost:8080/ 46 | 47 | # Screenshoot | Demo on [Heroku](https://crud-codeigniter4.herokuapp.com) 48 | | | | 49 | | ------------- | ------------- | 50 | | Index | Create | 51 | | ![Image of login](public/1.png)| ![Image of Index](public/2.png)| 52 | | Update | Delete | 53 | | ![Image of Index](public/3.png)| ![Image of Index](public/4.png) | 54 | -------------------------------------------------------------------------------- /app/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | Require all denied 3 | 4 | 5 | Deny from all 6 | 7 | -------------------------------------------------------------------------------- /app/Commands/RefreshCommand.php: -------------------------------------------------------------------------------- 1 | call('migrate:refresh', $params); 67 | // then seed data 68 | $this->call('db:seed', ['BookSeeder']); 69 | } catch (\Exception $e) { 70 | $this->showError($e); 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /app/Common.php: -------------------------------------------------------------------------------- 1 | SYSTEMPATH, 36 | * 'App' => APPPATH 37 | * ]; 38 | * 39 | * @var array 40 | */ 41 | public $psr4 = [ 42 | APP_NAMESPACE => APPPATH, // For custom app namespace 43 | 'Config' => APPPATH.'Config', 44 | ]; 45 | 46 | /** 47 | * ------------------------------------------------------------------- 48 | * Class Map 49 | * ------------------------------------------------------------------- 50 | * The class map provides a map of class names and their exact 51 | * location on the drive. Classes loaded in this manner will have 52 | * slightly faster performance because they will not have to be 53 | * searched for within one or more directories as they would if they 54 | * were being autoloaded through a namespace. 55 | * 56 | * Prototype: 57 | * 58 | * $classmap = [ 59 | * 'MyClass' => '/path/to/class/file.php' 60 | * ]; 61 | * 62 | * @var array 63 | */ 64 | public $classmap = []; 65 | } 66 | -------------------------------------------------------------------------------- /app/Config/Boot/development.php: -------------------------------------------------------------------------------- 1 | '127.0.0.1', 84 | 'port' => 11211, 85 | 'weight' => 1, 86 | 'raw' => false, 87 | ]; 88 | 89 | /* 90 | | ------------------------------------------------------------------------- 91 | | Redis settings 92 | | ------------------------------------------------------------------------- 93 | | Your Redis server can be specified below, if you are using 94 | | the Redis or Predis drivers. 95 | | 96 | */ 97 | public $redis = [ 98 | 'host' => '127.0.0.1', 99 | 'password' => null, 100 | 'port' => 6379, 101 | 'timeout' => 0, 102 | 'database' => 0, 103 | ]; 104 | 105 | /* 106 | |-------------------------------------------------------------------------- 107 | | Available Cache Handlers 108 | |-------------------------------------------------------------------------- 109 | | 110 | | This is an array of cache engine alias' and class names. Only engines 111 | | that are listed here are allowed to be used. 112 | | 113 | */ 114 | public $validHandlers = [ 115 | 'dummy' => \CodeIgniter\Cache\Handlers\DummyHandler::class, 116 | 'file' => \CodeIgniter\Cache\Handlers\FileHandler::class, 117 | 'memcached' => \CodeIgniter\Cache\Handlers\MemcachedHandler::class, 118 | 'predis' => \CodeIgniter\Cache\Handlers\PredisHandler::class, 119 | 'redis' => \CodeIgniter\Cache\Handlers\RedisHandler::class, 120 | 'wincache' => \CodeIgniter\Cache\Handlers\WincacheHandler::class, 121 | ]; 122 | } 123 | -------------------------------------------------------------------------------- /app/Config/Constants.php: -------------------------------------------------------------------------------- 1 | '', 33 | 'hostname' => 'localhost', 34 | 'username' => '', 35 | 'password' => '', 36 | 'database' => '', 37 | 'DBDriver' => 'MySQLi', 38 | 'DBPrefix' => '', 39 | 'pConnect' => false, 40 | 'DBDebug' => (ENVIRONMENT !== 'production'), 41 | 'cacheOn' => false, 42 | 'cacheDir' => '', 43 | 'charset' => 'utf8', 44 | 'DBCollat' => 'utf8_general_ci', 45 | 'swapPre' => '', 46 | 'encrypt' => false, 47 | 'compress' => false, 48 | 'strictOn' => false, 49 | 'failover' => [], 50 | 'port' => 3306, 51 | ]; 52 | 53 | /** 54 | * This database connection is used when 55 | * running PHPUnit database tests. 56 | * 57 | * @var array 58 | */ 59 | public $tests = [ 60 | 'DSN' => '', 61 | 'hostname' => '127.0.0.1', 62 | 'username' => '', 63 | 'password' => '', 64 | 'database' => '', 65 | 'DBDriver' => '', 66 | 'DBPrefix' => 'db_', // Needed to ensure we're working correctly with prefixes live. DO NOT REMOVE. 67 | 'pConnect' => false, 68 | 'DBDebug' => (ENVIRONMENT !== 'production'), 69 | 'cacheOn' => false, 70 | 'cacheDir' => '', 71 | 'charset' => 'utf8', 72 | 'DBCollat' => 'utf8_general_ci', 73 | 'swapPre' => '', 74 | 'encrypt' => false, 75 | 'compress' => false, 76 | 'strictOn' => false, 77 | 'failover' => [], 78 | 'port' => 3306, 79 | ]; 80 | 81 | //-------------------------------------------------------------------- 82 | 83 | public function __construct() 84 | { 85 | parent::__construct(); 86 | 87 | // Ensure that we always set the database group to 'tests' if 88 | // we are currently running an automated test suite, so that 89 | // we don't overwrite live data on accident. 90 | if (ENVIRONMENT === 'testing') { 91 | $this->defaultGroup = 'tests'; 92 | 93 | // Under Travis-CI, we can set an ENV var named 'DB_GROUP' 94 | // so that we can test against multiple databases. 95 | if ($group = getenv('DB')) { 96 | if (is_file(TESTPATH.'travis/Database.php')) { 97 | require TESTPATH.'travis/Database.php'; 98 | 99 | if (!empty($dbconfig) && array_key_exists($group, $dbconfig)) { 100 | $this->tests = $dbconfig[$group]; 101 | } 102 | } 103 | } 104 | } 105 | } 106 | 107 | //-------------------------------------------------------------------- 108 | } 109 | -------------------------------------------------------------------------------- /app/Config/DocTypes.php: -------------------------------------------------------------------------------- 1 | '', 13 | 'xhtml1-strict' => '', 14 | 'xhtml1-trans' => '', 15 | 'xhtml1-frame' => '', 16 | 'xhtml-basic11' => '', 17 | 'html5' => '', 18 | 'html4-strict' => '', 19 | 'html4-trans' => '', 20 | 'html4-frame' => '', 21 | 'mathml1' => '', 22 | 'mathml2' => '', 23 | 'svg10' => '', 24 | 'svg11' => '', 25 | 'svg11-basic' => '', 26 | 'svg11-tiny' => '', 27 | 'xhtml-math-svg-xh' => '', 28 | 'xhtml-math-svg-sh' => '', 29 | 'xhtml-rdfa-1' => '', 30 | 'xhtml-rdfa-2' => '', 31 | ]; 32 | } 33 | -------------------------------------------------------------------------------- /app/Config/Email.php: -------------------------------------------------------------------------------- 1 | 0) { 32 | ob_end_flush(); 33 | } 34 | 35 | ob_start(function ($buffer) { 36 | return $buffer; 37 | }); 38 | } 39 | 40 | /* 41 | * -------------------------------------------------------------------- 42 | * Debug Toolbar Listeners. 43 | * -------------------------------------------------------------------- 44 | * If you delete, they will no longer be collected. 45 | */ 46 | if (ENVIRONMENT !== 'production') { 47 | Events::on('DBQuery', 'CodeIgniter\Debug\Toolbar\Collectors\Database::collect'); 48 | Services::toolbar()->respond(); 49 | } 50 | }); 51 | -------------------------------------------------------------------------------- /app/Config/Exceptions.php: -------------------------------------------------------------------------------- 1 | \CodeIgniter\Filters\CSRF::class, 13 | 'toolbar' => \CodeIgniter\Filters\DebugToolbar::class, 14 | 'honeypot' => \CodeIgniter\Filters\Honeypot::class, 15 | 'cors' => \Fluent\Cors\Filters\CorsFilter::class, 16 | ]; 17 | 18 | // Always applied before every request 19 | public $globals = [ 20 | 'before' => [ 21 | //'honeypot' 22 | 'csrf' => [ 23 | 'except' => ['api/*'], 24 | ], 25 | ], 26 | 'after' => [ 27 | 'toolbar', 28 | //'honeypot' 29 | ], 30 | ]; 31 | 32 | // Works on all of a particular HTTP method 33 | // (GET, POST, etc) as BEFORE filters only 34 | // like: 'post' => ['CSRF', 'throttle'], 35 | public $methods = []; 36 | 37 | // List filter aliases and any before/after uri patterns 38 | // that they should run on, like: 39 | // 'isLoggedIn' => ['before' => ['account/*', 'profiles/*']], 40 | public $filters = []; 41 | } 42 | -------------------------------------------------------------------------------- /app/Config/ForeignCharacters.php: -------------------------------------------------------------------------------- 1 | \CodeIgniter\Format\JSONFormatter::class, 41 | 'application/xml' => \CodeIgniter\Format\XMLFormatter::class, 42 | 'text/xml' => \CodeIgniter\Format\XMLFormatter::class, 43 | ]; 44 | 45 | /* 46 | |-------------------------------------------------------------------------- 47 | | Formatters Options 48 | |-------------------------------------------------------------------------- 49 | | 50 | | Additional Options to adjust default formatters behaviour. 51 | | For each mime type, list the additional options that should be used. 52 | | 53 | */ 54 | public $formatterOptions = [ 55 | 'application/json' => JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES, 56 | 'application/xml' => 0, 57 | 'text/xml' => 0, 58 | ]; 59 | //-------------------------------------------------------------------- 60 | 61 | /** 62 | * A Factory method to return the appropriate formatter for the given mime type. 63 | * 64 | * @param string $mime 65 | * 66 | * @return \CodeIgniter\Format\FormatterInterface 67 | */ 68 | public function getFormatter(string $mime) 69 | { 70 | if (!array_key_exists($mime, $this->formatters)) { 71 | throw new \InvalidArgumentException('No Formatter defined for mime type: '.$mime); 72 | } 73 | 74 | $class = $this->formatters[$mime]; 75 | 76 | if (!class_exists($class)) { 77 | throw new \BadMethodCallException($class.' is not a valid Formatter.'); 78 | } 79 | 80 | return new $class(); 81 | } 82 | 83 | //-------------------------------------------------------------------- 84 | } 85 | -------------------------------------------------------------------------------- /app/Config/Honeypot.php: -------------------------------------------------------------------------------- 1 | {label}'; 35 | 36 | /** 37 | * Honeypot container. 38 | * 39 | * @var string 40 | */ 41 | public $container = '
{template}
'; 42 | } 43 | -------------------------------------------------------------------------------- /app/Config/Images.php: -------------------------------------------------------------------------------- 1 | \CodeIgniter\Images\Handlers\GDHandler::class, 31 | 'imagick' => \CodeIgniter\Images\Handlers\ImageMagickHandler::class, 32 | ]; 33 | } 34 | -------------------------------------------------------------------------------- /app/Config/Kint.php: -------------------------------------------------------------------------------- 1 | [ 91 | 92 | /* 93 | * The log levels that this handler will handle. 94 | */ 95 | 'handles' => [ 96 | 'critical', 97 | 'alert', 98 | 'emergency', 99 | 'debug', 100 | 'error', 101 | 'info', 102 | 'notice', 103 | 'warning', 104 | ], 105 | 106 | /* 107 | * Leave this BLANK unless you would like to set something other than the default 108 | * writeable/logs/ directory. Use a full getServer path with trailing slash. 109 | */ 110 | 'path' => WRITEPATH.'logs/', 111 | 112 | /* 113 | * The default filename extension for log files. The default 'php' allows for 114 | * protecting the log files via basic scripting, when they are to be stored 115 | * under a publicly accessible directory. 116 | * 117 | * Note: Leaving it blank will default to 'php'. 118 | */ 119 | 'fileExtension' => 'php', 120 | 121 | /* 122 | * The file system permissions to be applied on newly created log files. 123 | * 124 | * IMPORTANT: This MUST be an integer (no quotes) and you MUST use octal 125 | * integer notation (i.e. 0700, 0644, etc.) 126 | */ 127 | 'filePermissions' => 0644, 128 | ], 129 | 130 | /** 131 | * The ChromeLoggerHandler requires the use of the Chrome web browser 132 | * and the ChromeLogger extension. Uncomment this block to use it. 133 | */ 134 | // 'CodeIgniter\Log\Handlers\ChromeLoggerHandler' => [ 135 | // /* 136 | // * The log levels that this handler will handle. 137 | // */ 138 | // 'handles' => ['critical', 'alert', 'emergency', 'debug', 139 | // 'error', 'info', 'notice', 'warning'], 140 | // ] 141 | ]; 142 | } 143 | -------------------------------------------------------------------------------- /app/Config/Migrations.php: -------------------------------------------------------------------------------- 1 | php spark migrate:create 43 | | 44 | | Typical formats: 45 | | YmdHis_ 46 | | Y-m-d-His_ 47 | | Y_m_d_His_ 48 | | 49 | */ 50 | public $timestampFormat = 'Y-m-d-His_'; 51 | } 52 | -------------------------------------------------------------------------------- /app/Config/Mimes.php: -------------------------------------------------------------------------------- 1 | [ 27 | 'application/mac-binhex40', 28 | 'application/mac-binhex', 29 | 'application/x-binhex40', 30 | 'application/x-mac-binhex40', 31 | ], 32 | 'cpt' => 'application/mac-compactpro', 33 | 'csv' => [ 34 | 'text/csv', 35 | 'text/x-comma-separated-values', 36 | 'text/comma-separated-values', 37 | 'application/octet-stream', 38 | 'application/vnd.ms-excel', 39 | 'application/x-csv', 40 | 'text/x-csv', 41 | 'application/csv', 42 | 'application/excel', 43 | 'application/vnd.msexcel', 44 | 'text/plain', 45 | ], 46 | 'bin' => [ 47 | 'application/macbinary', 48 | 'application/mac-binary', 49 | 'application/octet-stream', 50 | 'application/x-binary', 51 | 'application/x-macbinary', 52 | ], 53 | 'dms' => 'application/octet-stream', 54 | 'lha' => 'application/octet-stream', 55 | 'lzh' => 'application/octet-stream', 56 | 'exe' => [ 57 | 'application/octet-stream', 58 | 'application/x-msdownload', 59 | ], 60 | 'class' => 'application/octet-stream', 61 | 'psd' => [ 62 | 'application/x-photoshop', 63 | 'image/vnd.adobe.photoshop', 64 | ], 65 | 'so' => 'application/octet-stream', 66 | 'sea' => 'application/octet-stream', 67 | 'dll' => 'application/octet-stream', 68 | 'oda' => 'application/oda', 69 | 'pdf' => [ 70 | 'application/pdf', 71 | 'application/force-download', 72 | 'application/x-download', 73 | 'binary/octet-stream', 74 | ], 75 | 'ai' => [ 76 | 'application/pdf', 77 | 'application/postscript', 78 | ], 79 | 'eps' => 'application/postscript', 80 | 'ps' => 'application/postscript', 81 | 'smi' => 'application/smil', 82 | 'smil' => 'application/smil', 83 | 'mif' => 'application/vnd.mif', 84 | 'xls' => [ 85 | 'application/vnd.ms-excel', 86 | 'application/msexcel', 87 | 'application/x-msexcel', 88 | 'application/x-ms-excel', 89 | 'application/x-excel', 90 | 'application/x-dos_ms_excel', 91 | 'application/xls', 92 | 'application/x-xls', 93 | 'application/excel', 94 | 'application/download', 95 | 'application/vnd.ms-office', 96 | 'application/msword', 97 | ], 98 | 'ppt' => [ 99 | 'application/vnd.ms-powerpoint', 100 | 'application/powerpoint', 101 | 'application/vnd.ms-office', 102 | 'application/msword', 103 | ], 104 | 'pptx' => [ 105 | 'application/vnd.openxmlformats-officedocument.presentationml.presentation', 106 | 'application/x-zip', 107 | 'application/zip', 108 | ], 109 | 'wbxml' => 'application/wbxml', 110 | 'wmlc' => 'application/wmlc', 111 | 'dcr' => 'application/x-director', 112 | 'dir' => 'application/x-director', 113 | 'dxr' => 'application/x-director', 114 | 'dvi' => 'application/x-dvi', 115 | 'gtar' => 'application/x-gtar', 116 | 'gz' => 'application/x-gzip', 117 | 'gzip' => 'application/x-gzip', 118 | 'php' => [ 119 | 'application/x-php', 120 | 'application/x-httpd-php', 121 | 'application/php', 122 | 'text/php', 123 | 'text/x-php', 124 | 'application/x-httpd-php-source', 125 | ], 126 | 'php4' => 'application/x-httpd-php', 127 | 'php3' => 'application/x-httpd-php', 128 | 'phtml' => 'application/x-httpd-php', 129 | 'phps' => 'application/x-httpd-php-source', 130 | 'js' => [ 131 | 'application/x-javascript', 132 | 'text/plain', 133 | ], 134 | 'swf' => 'application/x-shockwave-flash', 135 | 'sit' => 'application/x-stuffit', 136 | 'tar' => 'application/x-tar', 137 | 'tgz' => [ 138 | 'application/x-tar', 139 | 'application/x-gzip-compressed', 140 | ], 141 | 'z' => 'application/x-compress', 142 | 'xhtml' => 'application/xhtml+xml', 143 | 'xht' => 'application/xhtml+xml', 144 | 'zip' => [ 145 | 'application/x-zip', 146 | 'application/zip', 147 | 'application/x-zip-compressed', 148 | 'application/s-compressed', 149 | 'multipart/x-zip', 150 | ], 151 | 'rar' => [ 152 | 'application/x-rar', 153 | 'application/rar', 154 | 'application/x-rar-compressed', 155 | ], 156 | 'mid' => 'audio/midi', 157 | 'midi' => 'audio/midi', 158 | 'mpga' => 'audio/mpeg', 159 | 'mp2' => 'audio/mpeg', 160 | 'mp3' => [ 161 | 'audio/mpeg', 162 | 'audio/mpg', 163 | 'audio/mpeg3', 164 | 'audio/mp3', 165 | ], 166 | 'aif' => [ 167 | 'audio/x-aiff', 168 | 'audio/aiff', 169 | ], 170 | 'aiff' => [ 171 | 'audio/x-aiff', 172 | 'audio/aiff', 173 | ], 174 | 'aifc' => 'audio/x-aiff', 175 | 'ram' => 'audio/x-pn-realaudio', 176 | 'rm' => 'audio/x-pn-realaudio', 177 | 'rpm' => 'audio/x-pn-realaudio-plugin', 178 | 'ra' => 'audio/x-realaudio', 179 | 'rv' => 'video/vnd.rn-realvideo', 180 | 'wav' => [ 181 | 'audio/x-wav', 182 | 'audio/wave', 183 | 'audio/wav', 184 | ], 185 | 'bmp' => [ 186 | 'image/bmp', 187 | 'image/x-bmp', 188 | 'image/x-bitmap', 189 | 'image/x-xbitmap', 190 | 'image/x-win-bitmap', 191 | 'image/x-windows-bmp', 192 | 'image/ms-bmp', 193 | 'image/x-ms-bmp', 194 | 'application/bmp', 195 | 'application/x-bmp', 196 | 'application/x-win-bitmap', 197 | ], 198 | 'gif' => 'image/gif', 199 | 'jpg' => [ 200 | 'image/jpeg', 201 | 'image/pjpeg', 202 | ], 203 | 'jpeg' => [ 204 | 'image/jpeg', 205 | 'image/pjpeg', 206 | ], 207 | 'jpe' => [ 208 | 'image/jpeg', 209 | 'image/pjpeg', 210 | ], 211 | 'jp2' => [ 212 | 'image/jp2', 213 | 'video/mj2', 214 | 'image/jpx', 215 | 'image/jpm', 216 | ], 217 | 'j2k' => [ 218 | 'image/jp2', 219 | 'video/mj2', 220 | 'image/jpx', 221 | 'image/jpm', 222 | ], 223 | 'jpf' => [ 224 | 'image/jp2', 225 | 'video/mj2', 226 | 'image/jpx', 227 | 'image/jpm', 228 | ], 229 | 'jpg2' => [ 230 | 'image/jp2', 231 | 'video/mj2', 232 | 'image/jpx', 233 | 'image/jpm', 234 | ], 235 | 'jpx' => [ 236 | 'image/jp2', 237 | 'video/mj2', 238 | 'image/jpx', 239 | 'image/jpm', 240 | ], 241 | 'jpm' => [ 242 | 'image/jp2', 243 | 'video/mj2', 244 | 'image/jpx', 245 | 'image/jpm', 246 | ], 247 | 'mj2' => [ 248 | 'image/jp2', 249 | 'video/mj2', 250 | 'image/jpx', 251 | 'image/jpm', 252 | ], 253 | 'mjp2' => [ 254 | 'image/jp2', 255 | 'video/mj2', 256 | 'image/jpx', 257 | 'image/jpm', 258 | ], 259 | 'png' => [ 260 | 'image/png', 261 | 'image/x-png', 262 | ], 263 | 'tif' => 'image/tiff', 264 | 'tiff' => 'image/tiff', 265 | 'css' => [ 266 | 'text/css', 267 | 'text/plain', 268 | ], 269 | 'html' => [ 270 | 'text/html', 271 | 'text/plain', 272 | ], 273 | 'htm' => [ 274 | 'text/html', 275 | 'text/plain', 276 | ], 277 | 'shtml' => [ 278 | 'text/html', 279 | 'text/plain', 280 | ], 281 | 'txt' => 'text/plain', 282 | 'text' => 'text/plain', 283 | 'log' => [ 284 | 'text/plain', 285 | 'text/x-log', 286 | ], 287 | 'rtx' => 'text/richtext', 288 | 'rtf' => 'text/rtf', 289 | 'xml' => [ 290 | 'application/xml', 291 | 'text/xml', 292 | 'text/plain', 293 | ], 294 | 'xsl' => [ 295 | 'application/xml', 296 | 'text/xsl', 297 | 'text/xml', 298 | ], 299 | 'mpeg' => 'video/mpeg', 300 | 'mpg' => 'video/mpeg', 301 | 'mpe' => 'video/mpeg', 302 | 'qt' => 'video/quicktime', 303 | 'mov' => 'video/quicktime', 304 | 'avi' => [ 305 | 'video/x-msvideo', 306 | 'video/msvideo', 307 | 'video/avi', 308 | 'application/x-troff-msvideo', 309 | ], 310 | 'movie' => 'video/x-sgi-movie', 311 | 'doc' => [ 312 | 'application/msword', 313 | 'application/vnd.ms-office', 314 | ], 315 | 'docx' => [ 316 | 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 317 | 'application/zip', 318 | 'application/msword', 319 | 'application/x-zip', 320 | ], 321 | 'dot' => [ 322 | 'application/msword', 323 | 'application/vnd.ms-office', 324 | ], 325 | 'dotx' => [ 326 | 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 327 | 'application/zip', 328 | 'application/msword', 329 | ], 330 | 'xlsx' => [ 331 | 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 332 | 'application/zip', 333 | 'application/vnd.ms-excel', 334 | 'application/msword', 335 | 'application/x-zip', 336 | ], 337 | 'word' => [ 338 | 'application/msword', 339 | 'application/octet-stream', 340 | ], 341 | 'xl' => 'application/excel', 342 | 'eml' => 'message/rfc822', 343 | 'json' => [ 344 | 'application/json', 345 | 'text/json', 346 | ], 347 | 'pem' => [ 348 | 'application/x-x509-user-cert', 349 | 'application/x-pem-file', 350 | 'application/octet-stream', 351 | ], 352 | 'p10' => [ 353 | 'application/x-pkcs10', 354 | 'application/pkcs10', 355 | ], 356 | 'p12' => 'application/x-pkcs12', 357 | 'p7a' => 'application/x-pkcs7-signature', 358 | 'p7c' => [ 359 | 'application/pkcs7-mime', 360 | 'application/x-pkcs7-mime', 361 | ], 362 | 'p7m' => [ 363 | 'application/pkcs7-mime', 364 | 'application/x-pkcs7-mime', 365 | ], 366 | 'p7r' => 'application/x-pkcs7-certreqresp', 367 | 'p7s' => 'application/pkcs7-signature', 368 | 'crt' => [ 369 | 'application/x-x509-ca-cert', 370 | 'application/x-x509-user-cert', 371 | 'application/pkix-cert', 372 | ], 373 | 'crl' => [ 374 | 'application/pkix-crl', 375 | 'application/pkcs-crl', 376 | ], 377 | 'der' => 'application/x-x509-ca-cert', 378 | 'kdb' => 'application/octet-stream', 379 | 'pgp' => 'application/pgp', 380 | 'gpg' => 'application/gpg-keys', 381 | 'sst' => 'application/octet-stream', 382 | 'csr' => 'application/octet-stream', 383 | 'rsa' => 'application/x-pkcs7', 384 | 'cer' => [ 385 | 'application/pkix-cert', 386 | 'application/x-x509-ca-cert', 387 | ], 388 | '3g2' => 'video/3gpp2', 389 | '3gp' => [ 390 | 'video/3gp', 391 | 'video/3gpp', 392 | ], 393 | 'mp4' => 'video/mp4', 394 | 'm4a' => 'audio/x-m4a', 395 | 'f4v' => [ 396 | 'video/mp4', 397 | 'video/x-f4v', 398 | ], 399 | 'flv' => 'video/x-flv', 400 | 'webm' => 'video/webm', 401 | 'aac' => 'audio/x-acc', 402 | 'm4u' => 'application/vnd.mpegurl', 403 | 'm3u' => 'text/plain', 404 | 'xspf' => 'application/xspf+xml', 405 | 'vlc' => 'application/videolan', 406 | 'wmv' => [ 407 | 'video/x-ms-wmv', 408 | 'video/x-ms-asf', 409 | ], 410 | 'au' => 'audio/x-au', 411 | 'ac3' => 'audio/ac3', 412 | 'flac' => 'audio/x-flac', 413 | 'ogg' => [ 414 | 'audio/ogg', 415 | 'video/ogg', 416 | 'application/ogg', 417 | ], 418 | 'kmz' => [ 419 | 'application/vnd.google-earth.kmz', 420 | 'application/zip', 421 | 'application/x-zip', 422 | ], 423 | 'kml' => [ 424 | 'application/vnd.google-earth.kml+xml', 425 | 'application/xml', 426 | 'text/xml', 427 | ], 428 | 'ics' => 'text/calendar', 429 | 'ical' => 'text/calendar', 430 | 'zsh' => 'text/x-scriptzsh', 431 | '7zip' => [ 432 | 'application/x-compressed', 433 | 'application/x-zip-compressed', 434 | 'application/zip', 435 | 'multipart/x-zip', 436 | ], 437 | 'cdr' => [ 438 | 'application/cdr', 439 | 'application/coreldraw', 440 | 'application/x-cdr', 441 | 'application/x-coreldraw', 442 | 'image/cdr', 443 | 'image/x-cdr', 444 | 'zz-application/zz-winassoc-cdr', 445 | ], 446 | 'wma' => [ 447 | 'audio/x-ms-wma', 448 | 'video/x-ms-asf', 449 | ], 450 | 'jar' => [ 451 | 'application/java-archive', 452 | 'application/x-java-application', 453 | 'application/x-jar', 454 | 'application/x-compressed', 455 | ], 456 | 'svg' => [ 457 | 'image/svg+xml', 458 | 'application/xml', 459 | 'text/xml', 460 | ], 461 | 'vcf' => 'text/x-vcard', 462 | 'srt' => [ 463 | 'text/srt', 464 | 'text/plain', 465 | ], 466 | 'vtt' => [ 467 | 'text/vtt', 468 | 'text/plain', 469 | ], 470 | 'ico' => [ 471 | 'image/x-icon', 472 | 'image/x-ico', 473 | 'image/vnd.microsoft.icon', 474 | ], 475 | ]; 476 | 477 | //-------------------------------------------------------------------- 478 | 479 | /** 480 | * Attempts to determine the best mime type for the given file extension. 481 | * 482 | * @param string $extension 483 | * 484 | * @return string|null The mime type found, or none if unable to determine. 485 | */ 486 | public static function guessTypeFromExtension(string $extension) 487 | { 488 | $extension = trim(strtolower($extension), '. '); 489 | 490 | if (!array_key_exists($extension, static::$mimes)) { 491 | return null; 492 | } 493 | 494 | return is_array(static::$mimes[$extension]) ? static::$mimes[$extension][0] : static::$mimes[$extension]; 495 | } 496 | 497 | //-------------------------------------------------------------------- 498 | 499 | /** 500 | * Attempts to determine the best file extension for a given mime type. 501 | * 502 | * @param string $type 503 | * @param string $proposed_extension - default extension (in case there is more than one with the same mime type) 504 | * 505 | * @return string|null The extension determined, or null if unable to match. 506 | */ 507 | public static function guessExtensionFromType(string $type, ?string $proposed_extension = null) 508 | { 509 | $type = trim(strtolower($type), '. '); 510 | 511 | $proposed_extension = trim(strtolower($proposed_extension)); 512 | 513 | if (!is_null($proposed_extension) && array_key_exists($proposed_extension, static::$mimes) && in_array($type, is_string(static::$mimes[$proposed_extension]) ? [static::$mimes[$proposed_extension]] : static::$mimes[$proposed_extension])) { 514 | return $proposed_extension; 515 | } 516 | 517 | foreach (static::$mimes as $ext => $types) { 518 | if (is_string($types) && $types === $type) { 519 | return $ext; 520 | } elseif (is_array($types) && in_array($type, $types)) { 521 | return $ext; 522 | } 523 | } 524 | 525 | return null; 526 | } 527 | 528 | //-------------------------------------------------------------------- 529 | } 530 | -------------------------------------------------------------------------------- /app/Config/Modules.php: -------------------------------------------------------------------------------- 1 | 'CodeIgniter\Pager\Views\default_full', 24 | 'default_simple' => 'CodeIgniter\Pager\Views\default_simple', 25 | 'default_head' => 'CodeIgniter\Pager\Views\default_head', 26 | ]; 27 | 28 | /* 29 | |-------------------------------------------------------------------------- 30 | | Items Per Page 31 | |-------------------------------------------------------------------------- 32 | | 33 | | The default number of results shown in a single page. 34 | | 35 | */ 36 | public $perPage = 20; 37 | } 38 | -------------------------------------------------------------------------------- /app/Config/Paths.php: -------------------------------------------------------------------------------- 1 | defaultNamespace() 42 | * 43 | * Modifies the namespace that is added to a controller if it doesn't 44 | * already have one. By default this is the global namespace (\). 45 | * 46 | * $routes->defaultController() 47 | * 48 | * Changes the name of the class used as a controller when the route 49 | * points to a folder instead of a class. 50 | * 51 | * $routes->defaultMethod() 52 | * 53 | * Assigns the method inside the controller that is ran when the 54 | * Router is unable to determine the appropriate method to run. 55 | * 56 | * $routes->setAutoRoute() 57 | * 58 | * Determines whether the Router will attempt to match URIs to 59 | * Controllers when no specific route has been defined. If false, 60 | * only routes that have been defined here will be available. 61 | */ 62 | $routes->setDefaultNamespace('App\Controllers'); 63 | $routes->setDefaultController('Home'); 64 | $routes->setDefaultMethod('index'); 65 | $routes->setTranslateURIDashes(false); 66 | $routes->set404Override(); 67 | $routes->setAutoRoute(false); 68 | 69 | /** 70 | * -------------------------------------------------------------------- 71 | * Route Definitions 72 | * --------------------------------------------------------------------. 73 | */ 74 | 75 | // We get a performance increase by specifying the default 76 | // route since we don't have to scan directories. 77 | 78 | $routes->get('/', 'Home::index'); 79 | 80 | $routes->group('api/v1', ['filter' => 'cors', 'namespace' => 'App\Controllers\Api'], function ($routes) { 81 | $routes->resource('books', [ 82 | 'controller' => 'BookApiController', 83 | ]); 84 | 85 | $routes->resource('statuses', [ 86 | 'controller' => 'StatusApiController', 87 | ]); 88 | }); 89 | 90 | $routes->group('book', function ($routes) { 91 | $routes->post('datatable', 'BookController::datatable', ['as' => 'datatable']); 92 | $routes->resource('resource', [ 93 | 'controller' => 'BookController', 94 | ]); 95 | }); 96 | 97 | /** 98 | * -------------------------------------------------------------------- 99 | * Additional Routing 100 | * --------------------------------------------------------------------. 101 | * 102 | * There will often be times that you need additional routing and you 103 | * need to it be able to override any defaults in this file. Environment 104 | * based routes is one such time. require() additional route files here 105 | * to make that happen. 106 | * 107 | * You will have access to the $routes object within that file without 108 | * needing to reload it. 109 | */ 110 | if (file_exists(APPPATH.'Config/'.ENVIRONMENT.'/Routes.php')) { 111 | require APPPATH.'Config/'.ENVIRONMENT.'/Routes.php'; 112 | } 113 | -------------------------------------------------------------------------------- /app/Config/Services.php: -------------------------------------------------------------------------------- 1 | 'Windows 10', 20 | 'windows nt 6.3' => 'Windows 8.1', 21 | 'windows nt 6.2' => 'Windows 8', 22 | 'windows nt 6.1' => 'Windows 7', 23 | 'windows nt 6.0' => 'Windows Vista', 24 | 'windows nt 5.2' => 'Windows 2003', 25 | 'windows nt 5.1' => 'Windows XP', 26 | 'windows nt 5.0' => 'Windows 2000', 27 | 'windows nt 4.0' => 'Windows NT 4.0', 28 | 'winnt4.0' => 'Windows NT 4.0', 29 | 'winnt 4.0' => 'Windows NT', 30 | 'winnt' => 'Windows NT', 31 | 'windows 98' => 'Windows 98', 32 | 'win98' => 'Windows 98', 33 | 'windows 95' => 'Windows 95', 34 | 'win95' => 'Windows 95', 35 | 'windows phone' => 'Windows Phone', 36 | 'windows' => 'Unknown Windows OS', 37 | 'android' => 'Android', 38 | 'blackberry' => 'BlackBerry', 39 | 'iphone' => 'iOS', 40 | 'ipad' => 'iOS', 41 | 'ipod' => 'iOS', 42 | 'os x' => 'Mac OS X', 43 | 'ppc mac' => 'Power PC Mac', 44 | 'freebsd' => 'FreeBSD', 45 | 'ppc' => 'Macintosh', 46 | 'linux' => 'Linux', 47 | 'debian' => 'Debian', 48 | 'sunos' => 'Sun Solaris', 49 | 'beos' => 'BeOS', 50 | 'apachebench' => 'ApacheBench', 51 | 'aix' => 'AIX', 52 | 'irix' => 'Irix', 53 | 'osf' => 'DEC OSF', 54 | 'hp-ux' => 'HP-UX', 55 | 'netbsd' => 'NetBSD', 56 | 'bsdi' => 'BSDi', 57 | 'openbsd' => 'OpenBSD', 58 | 'gnu' => 'GNU/Linux', 59 | 'unix' => 'Unknown Unix OS', 60 | 'symbian' => 'Symbian OS', 61 | ]; 62 | 63 | // The order of this array should NOT be changed. Many browsers return 64 | // multiple browser types so we want to identify the sub-type first. 65 | public $browsers = [ 66 | 'OPR' => 'Opera', 67 | 'Flock' => 'Flock', 68 | 'Edge' => 'Spartan', 69 | 'Chrome' => 'Chrome', 70 | // Opera 10+ always reports Opera/9.80 and appends Version/ to the user agent string 71 | 'Opera.*?Version' => 'Opera', 72 | 'Opera' => 'Opera', 73 | 'MSIE' => 'Internet Explorer', 74 | 'Internet Explorer' => 'Internet Explorer', 75 | 'Trident.* rv' => 'Internet Explorer', 76 | 'Shiira' => 'Shiira', 77 | 'Firefox' => 'Firefox', 78 | 'Chimera' => 'Chimera', 79 | 'Phoenix' => 'Phoenix', 80 | 'Firebird' => 'Firebird', 81 | 'Camino' => 'Camino', 82 | 'Netscape' => 'Netscape', 83 | 'OmniWeb' => 'OmniWeb', 84 | 'Safari' => 'Safari', 85 | 'Mozilla' => 'Mozilla', 86 | 'Konqueror' => 'Konqueror', 87 | 'icab' => 'iCab', 88 | 'Lynx' => 'Lynx', 89 | 'Links' => 'Links', 90 | 'hotjava' => 'HotJava', 91 | 'amaya' => 'Amaya', 92 | 'IBrowse' => 'IBrowse', 93 | 'Maxthon' => 'Maxthon', 94 | 'Ubuntu' => 'Ubuntu Web Browser', 95 | 'Vivaldi' => 'Vivaldi', 96 | ]; 97 | 98 | public $mobiles = [ 99 | // legacy array, old values commented out 100 | 'mobileexplorer' => 'Mobile Explorer', 101 | // 'openwave' => 'Open Wave', 102 | // 'opera mini' => 'Opera Mini', 103 | // 'operamini' => 'Opera Mini', 104 | // 'elaine' => 'Palm', 105 | 'palmsource' => 'Palm', 106 | // 'digital paths' => 'Palm', 107 | // 'avantgo' => 'Avantgo', 108 | // 'xiino' => 'Xiino', 109 | 'palmscape' => 'Palmscape', 110 | // 'nokia' => 'Nokia', 111 | // 'ericsson' => 'Ericsson', 112 | // 'blackberry' => 'BlackBerry', 113 | // 'motorola' => 'Motorola' 114 | 115 | // Phones and Manufacturers 116 | 'motorola' => 'Motorola', 117 | 'nokia' => 'Nokia', 118 | 'palm' => 'Palm', 119 | 'iphone' => 'Apple iPhone', 120 | 'ipad' => 'iPad', 121 | 'ipod' => 'Apple iPod Touch', 122 | 'sony' => 'Sony Ericsson', 123 | 'ericsson' => 'Sony Ericsson', 124 | 'blackberry' => 'BlackBerry', 125 | 'cocoon' => 'O2 Cocoon', 126 | 'blazer' => 'Treo', 127 | 'lg' => 'LG', 128 | 'amoi' => 'Amoi', 129 | 'xda' => 'XDA', 130 | 'mda' => 'MDA', 131 | 'vario' => 'Vario', 132 | 'htc' => 'HTC', 133 | 'samsung' => 'Samsung', 134 | 'sharp' => 'Sharp', 135 | 'sie-' => 'Siemens', 136 | 'alcatel' => 'Alcatel', 137 | 'benq' => 'BenQ', 138 | 'ipaq' => 'HP iPaq', 139 | 'mot-' => 'Motorola', 140 | 'playstation portable' => 'PlayStation Portable', 141 | 'playstation 3' => 'PlayStation 3', 142 | 'playstation vita' => 'PlayStation Vita', 143 | 'hiptop' => 'Danger Hiptop', 144 | 'nec-' => 'NEC', 145 | 'panasonic' => 'Panasonic', 146 | 'philips' => 'Philips', 147 | 'sagem' => 'Sagem', 148 | 'sanyo' => 'Sanyo', 149 | 'spv' => 'SPV', 150 | 'zte' => 'ZTE', 151 | 'sendo' => 'Sendo', 152 | 'nintendo dsi' => 'Nintendo DSi', 153 | 'nintendo ds' => 'Nintendo DS', 154 | 'nintendo 3ds' => 'Nintendo 3DS', 155 | 'wii' => 'Nintendo Wii', 156 | 'open web' => 'Open Web', 157 | 'openweb' => 'OpenWeb', 158 | 159 | // Operating Systems 160 | 'android' => 'Android', 161 | 'symbian' => 'Symbian', 162 | 'SymbianOS' => 'SymbianOS', 163 | 'elaine' => 'Palm', 164 | 'series60' => 'Symbian S60', 165 | 'windows ce' => 'Windows CE', 166 | 167 | // Browsers 168 | 'obigo' => 'Obigo', 169 | 'netfront' => 'Netfront Browser', 170 | 'openwave' => 'Openwave Browser', 171 | 'mobilexplorer' => 'Mobile Explorer', 172 | 'operamini' => 'Opera Mini', 173 | 'opera mini' => 'Opera Mini', 174 | 'opera mobi' => 'Opera Mobile', 175 | 'fennec' => 'Firefox Mobile', 176 | 177 | // Other 178 | 'digital paths' => 'Digital Paths', 179 | 'avantgo' => 'AvantGo', 180 | 'xiino' => 'Xiino', 181 | 'novarra' => 'Novarra Transcoder', 182 | 'vodafone' => 'Vodafone', 183 | 'docomo' => 'NTT DoCoMo', 184 | 'o2' => 'O2', 185 | 186 | // Fallback 187 | 'mobile' => 'Generic Mobile', 188 | 'wireless' => 'Generic Mobile', 189 | 'j2me' => 'Generic Mobile', 190 | 'midp' => 'Generic Mobile', 191 | 'cldc' => 'Generic Mobile', 192 | 'up.link' => 'Generic Mobile', 193 | 'up.browser' => 'Generic Mobile', 194 | 'smartphone' => 'Generic Mobile', 195 | 'cellphone' => 'Generic Mobile', 196 | ]; 197 | 198 | // There are hundreds of bots but these are the most common. 199 | public $robots = [ 200 | 'googlebot' => 'Googlebot', 201 | 'msnbot' => 'MSNBot', 202 | 'baiduspider' => 'Baiduspider', 203 | 'bingbot' => 'Bing', 204 | 'slurp' => 'Inktomi Slurp', 205 | 'yahoo' => 'Yahoo', 206 | 'ask jeeves' => 'Ask Jeeves', 207 | 'fastcrawler' => 'FastCrawler', 208 | 'infoseek' => 'InfoSeek Robot 1.0', 209 | 'lycos' => 'Lycos', 210 | 'yandex' => 'YandexBot', 211 | 'mediapartners-google' => 'MediaPartners Google', 212 | 'CRAZYWEBCRAWLER' => 'Crazy Webcrawler', 213 | 'adsbot-google' => 'AdsBot Google', 214 | 'feedfetcher-google' => 'Feedfetcher Google', 215 | 'curious george' => 'Curious George', 216 | 'ia_archiver' => 'Alexa Crawler', 217 | 'MJ12bot' => 'Majestic-12', 218 | 'Uptimebot' => 'Uptimebot', 219 | ]; 220 | } 221 | -------------------------------------------------------------------------------- /app/Config/Validation.php: -------------------------------------------------------------------------------- 1 | 'CodeIgniter\Validation\Views\list', 32 | 'single' => 'CodeIgniter\Validation\Views\single', 33 | ]; 34 | 35 | //-------------------------------------------------------------------- 36 | // Rules 37 | //-------------------------------------------------------------------- 38 | } 39 | -------------------------------------------------------------------------------- /app/Config/View.php: -------------------------------------------------------------------------------- 1 | book = new BookRepository(); 20 | $this->pager = Config::get('Pager')->perPage; 21 | } 22 | 23 | /** 24 | * index. 25 | * 26 | * @return \CodeIgniter\Http\Response 27 | */ 28 | public function index() 29 | { 30 | $resource = $this->book->scope($this->request) 31 | ->withCriteria([new BookCriteria()]) 32 | ->paginate(null, static::withSelect()); 33 | 34 | return $this->fractalCollection($resource, new BookTransformer()); 35 | } 36 | 37 | /** 38 | * show. 39 | * 40 | * @return \CodeIgniter\Http\Response 41 | */ 42 | public function show($id = null) 43 | { 44 | $resource = $this->book->withCriteria([new BookCriteria()])->find($id, static::withSelect()); 45 | 46 | if (is_null($resource)) { 47 | return $this->failNotFound(sprintf('book with id %d not found', $id)); 48 | } 49 | 50 | return $this->fractalItem($resource, new BookTransformer()); 51 | } 52 | 53 | /** 54 | * create. 55 | * 56 | * @return \CodeIgniter\Http\Response 57 | */ 58 | public function create() 59 | { 60 | $request = $this->request->getPost(null, FILTER_SANITIZE_SPECIAL_CHARS); 61 | 62 | if (!$this->validate(static::rules())) { 63 | return $this->fail($this->validator->getErrors()); 64 | } 65 | 66 | try { 67 | $resource = $this->book->create($request); 68 | } catch (\Exception $e) { 69 | return $this->fail($e->getMessage()); 70 | } 71 | 72 | return $this->respondCreated($resource); 73 | } 74 | 75 | /** 76 | * edit. 77 | * 78 | * @param int $id 79 | * 80 | * @return CodeIgniter\Http\Response 81 | */ 82 | public function edit($id = null) 83 | { 84 | return $this->show($id); 85 | } 86 | 87 | /** 88 | * update. 89 | * 90 | * @param int $id 91 | * 92 | * @return CodeIgniter\Http\Response 93 | */ 94 | public function update($id = null) 95 | { 96 | $request = $this->request->getRawInput(); 97 | 98 | if (!$this->validate(static::rules())) { 99 | return $this->fail($this->validator->getErrors()); 100 | } 101 | 102 | try { 103 | $this->book->update($request, $id); 104 | } catch (\Exception $e) { 105 | return $this->fail($e->getMessage()); 106 | } 107 | 108 | return $this->respondUpdated(['id' => $id], "book id {$id} updated"); 109 | } 110 | 111 | /** 112 | * delete. 113 | * 114 | * @param int $id 115 | * 116 | * @return CodeIgniter\Http\Response 117 | */ 118 | public function delete($id = null) 119 | { 120 | $this->book->destroy($id); 121 | 122 | if ((new BookModel())->db->affectedRows() === 0) { 123 | return $this->failNotFound(sprintf('book with id %d not found or already deleted', $id)); 124 | } 125 | 126 | return $this->respondDeleted(['id' => $id], "book id {$id} deleted"); 127 | } 128 | 129 | /** 130 | * With select. 131 | * 132 | * @return array 133 | */ 134 | protected static function withSelect() 135 | { 136 | return [ 137 | 'books.id', 'books.status_id', 'books.title', 'books.author', 'status.status', 'books.description', 'books.created_at', 'books.updated_at', 138 | ]; 139 | } 140 | 141 | /** 142 | * Rules set. 143 | * 144 | * @return array 145 | */ 146 | protected static function rules() 147 | { 148 | return [ 149 | 'status_id' => 'required|numeric', 150 | 'title' => 'required|min_length[10]|max_length[60]', 151 | 'author' => 'required|min_length[10]|max_length[200]', 152 | 'description' => 'required|min_length[10]|max_length[200]', 153 | ]; 154 | } 155 | } 156 | -------------------------------------------------------------------------------- /app/Controllers/Api/StatusApiController.php: -------------------------------------------------------------------------------- 1 | status = new StatusRepository(); 19 | $this->pager = Config::get('Pager')->perPage; 20 | } 21 | 22 | /** 23 | * index. 24 | * 25 | * @return \CodeIgniter\Http\Response 26 | */ 27 | public function index() 28 | { 29 | $resource = $this->status->scope($this->request) 30 | ->paginate($this->pager); 31 | 32 | return $this->fractalCollection($resource, new StatusTransformer()); 33 | } 34 | 35 | /** 36 | * show. 37 | * 38 | * @return \CodeIgniter\Http\Response 39 | */ 40 | public function show($id = null) 41 | { 42 | $resource = $this->status->find($id); 43 | 44 | if (is_null($resource)) { 45 | return $this->failNotFound(sprintf('status with id %d not found', $id)); 46 | } 47 | 48 | return $this->fractalItem($resource, new StatusTransformer()); 49 | } 50 | 51 | /** 52 | * create. 53 | * 54 | * @return \CodeIgniter\Http\Response 55 | */ 56 | public function create() 57 | { 58 | $request = $this->request->getPost(null, FILTER_SANITIZE_SPECIAL_CHARS); 59 | 60 | if (!$this->validate(static::rules())) { 61 | return $this->fail($this->validator->getErrors()); 62 | } 63 | 64 | try { 65 | $resource = $this->status->create($request); 66 | } catch (\Exception $e) { 67 | return $this->fail($e->getMessage()); 68 | } 69 | 70 | return $this->respondCreated($resource); 71 | } 72 | 73 | /** 74 | * edit. 75 | * 76 | * @param int $id 77 | * 78 | * @return CodeIgniter\Http\Response 79 | */ 80 | public function edit($id = null) 81 | { 82 | return $this->show($id); 83 | } 84 | 85 | /** 86 | * update. 87 | * 88 | * @param int $id 89 | * 90 | * @return CodeIgniter\Http\Response 91 | */ 92 | public function update($id = null) 93 | { 94 | $request = $this->request->getRawInput(); 95 | 96 | if (!$this->validate(static::rules())) { 97 | return $this->fail($this->validator->getErrors()); 98 | } 99 | 100 | try { 101 | $this->status->update($request, $id); 102 | } catch (\Exception $e) { 103 | return $this->fail($e->getMessage()); 104 | } 105 | 106 | return $this->respondUpdated(['id' => $id], "status id {$id} updated"); 107 | } 108 | 109 | /** 110 | * delete. 111 | * 112 | * @param int $id 113 | * 114 | * @return CodeIgniter\Http\Response 115 | */ 116 | public function delete($id = null) 117 | { 118 | $this->status->destroy($id); 119 | 120 | if ((new StatusModel())->db->affectedRows() === 0) { 121 | return $this->failNotFound(sprintf('status with id %d not found or already deleted', $id)); 122 | } 123 | 124 | return $this->respondDeleted(['id' => $id], "status id {$id} deleted"); 125 | } 126 | 127 | /** 128 | * With response convert. 129 | * 130 | * @param array $resource 131 | * 132 | * @return array 133 | */ 134 | protected static function withResponse(array $resource) 135 | { 136 | return [ 137 | 'data' => $resource['data'], 138 | 'paginate' => $resource['paginate']->getDetails(), 139 | ]; 140 | } 141 | 142 | /** 143 | * Rules set. 144 | * 145 | * @return array 146 | */ 147 | protected static function rules() 148 | { 149 | return [ 150 | 'status' => 'required|min_length[10]|max_length[200]', 151 | ]; 152 | } 153 | } 154 | -------------------------------------------------------------------------------- /app/Controllers/BaseController.php: -------------------------------------------------------------------------------- 1 | session = \Config\Services::session(); 48 | } 49 | 50 | /** 51 | * @param mixed $data 52 | * @param string|callable|\App\Transformers\BaseTransformer $transformer 53 | * 54 | * @return \Spatie\Fractal\Fractal 55 | */ 56 | public function fractalCollection($data, BaseTransformer $transformer) 57 | { 58 | $fractal = Fractal::create($data['data'], $transformer, JsonApiSerializer::class) 59 | ->withResourceName($transformer->getResourceKey()) 60 | ->paginateWith(new CodeIgniterPaginatorAdapter($data['paginate'])); 61 | 62 | return $this->respond($fractal); 63 | } 64 | 65 | /** 66 | * @param mixed $data 67 | * @param string|callable|\App\Transformers\BaseTransformer $transformer 68 | * 69 | * @return \Spatie\Fractal\Fractal 70 | */ 71 | public function fractalItem($data, BaseTransformer $transformer) 72 | { 73 | $fractal = Fractal::create($data, $transformer, JsonApiSerializer::class) 74 | ->withResourceName($transformer->getResourceKey()); 75 | 76 | return $this->respond($fractal); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /app/Controllers/BookController.php: -------------------------------------------------------------------------------- 1 | model = new BookModel(); 21 | } 22 | 23 | /** 24 | * Tampilkan daftar index. 25 | * 26 | * @return \CodeIgniter\Http\Response 27 | */ 28 | public function index() 29 | { 30 | return view('BookView'); 31 | } 32 | 33 | /** 34 | * Tampilkan daftar index. 35 | * 36 | * @return \CodeIgniter\Http\Response 37 | */ 38 | public function show() 39 | { 40 | } 41 | 42 | /** 43 | * Simpan resource ke database. 44 | * 45 | * @return \CodeIgniter\Http\Response 46 | */ 47 | public function create() 48 | { 49 | if ($this->model->insert($this->request->getPost())) { 50 | return $this->respondCreated(); 51 | } 52 | 53 | return $this->fail($this->model->errors()); 54 | } 55 | 56 | /** 57 | * Tampilkan form untuk mengedit yang ditentukan. 58 | * 59 | * @param int $id 60 | * 61 | * @return CodeIgniter\Http\Response 62 | */ 63 | public function edit($id) 64 | { 65 | if ($found = $this->model->find($id)) { 66 | return $this->respond(['data' => $found]); 67 | } 68 | 69 | return $this->fail('Failed'); 70 | } 71 | 72 | /** 73 | * Update resource spesifik ke database. 74 | * 75 | * @param int $id 76 | * 77 | * @return CodeIgniter\Http\Response 78 | */ 79 | public function update($id) 80 | { 81 | if ($this->model->update($id, $this->request->getRawInput())) { 82 | return $this->respondCreated(); 83 | } 84 | 85 | return $this->fail($this->model->errors()); 86 | } 87 | 88 | /** 89 | * Hapus resource spesifik ke database. 90 | * 91 | * @param int $id 92 | * 93 | * @return CodeIgniter\Http\Response 94 | */ 95 | public function delete($id) 96 | { 97 | if ($found = $this->model->delete($id)) { 98 | return $this->respondDeleted($found); 99 | } 100 | 101 | return $this->fail('Fail deleted'); 102 | } 103 | 104 | /** 105 | * Function datatable. 106 | * 107 | * @return CodeIgniter\Http\Response 108 | */ 109 | public function datatable() 110 | { 111 | if ($this->request->isAJAX()) { 112 | $start = $this->request->getPost('start'); 113 | $length = $this->request->getPost('length'); 114 | $search = $this->request->getPost('search[value]'); 115 | $order = BookModel::ORDERABLE[$this->request->getPost('order[0][column]')]; 116 | $dir = $this->request->getPost('order[0][dir]'); 117 | 118 | return $this->respond([ 119 | 'draw' => $this->request->getPost('draw'), 120 | 'recordsTotal' => $this->model->getResource()->countAllResults(), 121 | 'recordsFiltered' => $this->model->getResource($search)->countAllResults(), 122 | 'data' => $this->model->getResource($search)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject(), 123 | ]); 124 | } 125 | 126 | return $this->respondNoContent(); 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /app/Controllers/Home.php: -------------------------------------------------------------------------------- 1 | response->setJSON(Book::paginate()); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/Criteria/BookCriteria.php: -------------------------------------------------------------------------------- 1 | join('status', 'books.status_id = status.id'); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /app/Database/Migrations/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ronaldtech051/Codeigniter4-Ajax-CRUD/8d62575caffb98ebfa55e66955cb62fd738f92d0/app/Database/Migrations/.gitkeep -------------------------------------------------------------------------------- /app/Database/Migrations/2020-01-10-112925_create_contact_table.php: -------------------------------------------------------------------------------- 1 | forge->addField([ 12 | 'id' => ['type' => 'INT', 'constraint' => 5, 'unsigned' => true, 'auto_increment' => true], 13 | 'status' => ['type' => 'VARCHAR', 'constraint' => 100], 14 | 'created_at' => ['type' => 'datetime', 'null' => true], 15 | 'updated_at' => ['type' => 'datetime', 'null' => true], 16 | 'deleted_at' => ['type' => 'datetime', 'null' => true], 17 | ]); 18 | 19 | $this->forge->addPrimaryKey('id'); 20 | $this->forge->createTable('status', false, ['ENGINE' => 'InnoDB']); 21 | 22 | $this->forge->addField([ 23 | 'id' => ['type' => 'INT', 'constraint' => 5, 'unsigned' => true, 'auto_increment' => true], 24 | 'status_id' => ['type' => 'INT', 'constraint' => 5, 'unsigned' => true, 'null' => true], 25 | 'title' => ['type' => 'VARCHAR', 'constraint' => '100'], 26 | 'author' => ['type' => 'VARCHAR', 'constraint' => 100, 'default' => 'King of Town'], 27 | 'description' => ['type' => 'TEXT', 'null' => true], 28 | 'created_at' => ['type' => 'datetime', 'null' => true], 29 | 'updated_at' => ['type' => 'datetime', 'null' => true], 30 | 'deleted_at' => ['type' => 'datetime', 'null' => true], 31 | ]); 32 | 33 | $this->forge->addPrimaryKey('id'); 34 | $this->forge->addKey('status_id'); 35 | $this->forge->addForeignKey('status_id', 'status', 'id', false, 'CASCADE'); 36 | $this->forge->createTable('books', false, ['ENGINE' => 'InnoDB']); 37 | } 38 | 39 | //-------------------------------------------------------------------- 40 | 41 | public function down() 42 | { 43 | $this->forge->dropTable('books'); 44 | $this->forge->dropTable('status'); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /app/Database/Seeds/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ronaldtech051/Codeigniter4-Ajax-CRUD/8d62575caffb98ebfa55e66955cb62fd738f92d0/app/Database/Seeds/.gitkeep -------------------------------------------------------------------------------- /app/Database/Seeds/BookSeeder.php: -------------------------------------------------------------------------------- 1 | db->table('status')->insertBatch([ 13 | [ 14 | 'status' => 'Publish', 15 | 'created_at' => date('Y-m-d H:i:s'), 16 | 'updated_at' => date('Y-m-d H:i:s'), 17 | ], 18 | [ 19 | 'status' => 'Pending', 20 | 'created_at' => date('Y-m-d H:i:s'), 21 | 'updated_at' => date('Y-m-d H:i:s'), 22 | ], 23 | [ 24 | 'status' => 'Draft', 25 | 'created_at' => date('Y-m-d H:i:s'), 26 | 'updated_at' => date('Y-m-d H:i:s'), 27 | ], 28 | ]); 29 | 30 | $faker = Faker\Factory::create(); 31 | 32 | for ($i = 0; $i < 1000; $i++) { 33 | $seed = [ 34 | 'title' => $faker->sentence, 35 | 'author' => $faker->name, 36 | 'description' => $faker->realText(), 37 | 'status_id' => $faker->randomElement(['1', '2', '3']), 38 | 'created_at' => date('Y-m-d H:i:s'), 39 | 'updated_at' => date('Y-m-d H:i:s'), 40 | ]; 41 | 42 | $data[] = $seed; 43 | } 44 | 45 | $this->db->table('books')->insertBatch($data); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /app/Entities/BookEntity.php: -------------------------------------------------------------------------------- 1 | 'required|numeric', 22 | 'title' => 'required|min_length[10]|max_length[60]', 23 | 'author' => 'required', 24 | 'description' => 'required|min_length[10]|max_length[200]', 25 | ]; 26 | protected $validationMessages = []; 27 | protected $skipValidation = false; 28 | 29 | const ORDERABLE = [ 30 | 1 => 'title', 31 | 2 => 'author', 32 | 3 => 'description', 33 | 4 => 'status', 34 | ]; 35 | 36 | public $orderable = ['title', 'author', 'description', 'status']; 37 | 38 | /** 39 | * Get resource data. 40 | * 41 | * @param string $search 42 | * 43 | * @return \CodeIgniter\Database\BaseBuilder 44 | */ 45 | public function getResource(string $search = '') 46 | { 47 | $builder = $this->builder() 48 | ->select('books.id, books.title, books.author, books.description, books.created_at, status.status') 49 | ->join('status', 'books.status_id = status.id'); 50 | 51 | $condition = empty($search) 52 | ? $builder 53 | : $builder->groupStart() 54 | ->like('title', $search) 55 | ->orLike('author', $search) 56 | ->orLike('description', $search) 57 | ->orLike('status', $search) 58 | ->groupEnd(); 59 | 60 | return $condition->where([ 61 | 'books.deleted_at' => null, 62 | 'status.deleted_at' => null, 63 | ]); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /app/Models/StatusModel.php: -------------------------------------------------------------------------------- 1 | 'required|min_length[10]|max_length[200]', 22 | ]; 23 | protected $validationMessages = []; 24 | protected $skipValidation = false; 25 | 26 | public $orderable = ['status']; 27 | } 28 | -------------------------------------------------------------------------------- /app/Repository/BookRepository.php: -------------------------------------------------------------------------------- 1 | 'like', 12 | 'author' => 'orLike', 13 | 'description' => 'orLike', 14 | 'status' => 'orLike', 15 | ]; 16 | 17 | public function entity() 18 | { 19 | return new BookModel(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/Repository/StatusRepository.php: -------------------------------------------------------------------------------- 1 | 'like', 12 | ]; 13 | 14 | public function entity() 15 | { 16 | return new StatusModel(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /app/ThirdParty/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ronaldtech051/Codeigniter4-Ajax-CRUD/8d62575caffb98ebfa55e66955cb62fd738f92d0/app/ThirdParty/.gitkeep -------------------------------------------------------------------------------- /app/Traits/HashableTrait.php: -------------------------------------------------------------------------------- 1 | decode($hash); 25 | } catch (\Exception $e) { 26 | return PageNotFoundException::forMethodNotFound($e->getMessage()); 27 | } 28 | 29 | return $decoce[0]; 30 | } 31 | 32 | /** 33 | * Enocode hash. 34 | * 35 | * @param string $hash 36 | * 37 | * @return mixed 38 | */ 39 | public function encodeHash(string $hash) 40 | { 41 | try { 42 | $encode = static::hashids()->encode($hash); 43 | } catch (\Exception $e) { 44 | return PageNotFoundException::forMethodNotFound($e->getMessage()); 45 | } 46 | 47 | return $encode; 48 | } 49 | 50 | /** 51 | * Instance class Hashids. 52 | */ 53 | protected static function hashids() 54 | { 55 | return new Hashids(Config::get('Encryption')->key, 32); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /app/Transformers/BaseTransformer.php: -------------------------------------------------------------------------------- 1 | getResourceKey()); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/Transformers/Book/BookTransformer.php: -------------------------------------------------------------------------------- 1 | $books->id, 28 | 'title' => $books->title, 29 | 'author' => $books->author, 30 | 'description' => $books->description, 31 | 'status' => [ 32 | 'status_id' => $books->status_id, 33 | 'status_name' => $books->status, 34 | ], 35 | 'created_at' => $books->created_at, 36 | 'updated_at' => $books->updated_at, 37 | ]; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /app/Transformers/CodeIgniterPaginatorAdapter.php: -------------------------------------------------------------------------------- 1 | paginator = $paginator; 27 | } 28 | 29 | /** 30 | * {@inheritdoc} 31 | */ 32 | public function getCurrentPage() 33 | { 34 | return $this->paginator->getCurrentPage(); 35 | } 36 | 37 | /** 38 | * {@inheritdoc} 39 | */ 40 | public function getLastPage() 41 | { 42 | return $this->paginator->getLastPage(); 43 | } 44 | 45 | /** 46 | * {@inheritdoc} 47 | */ 48 | public function getTotal() 49 | { 50 | // TODO: Change to getTotal() on new release version. 51 | return $this->paginator->getDetails()['total']; 52 | } 53 | 54 | /** 55 | * {@inheritdoc} 56 | */ 57 | public function getCount() 58 | { 59 | return $this->paginator->getPageCount(); 60 | } 61 | 62 | /** 63 | * {@inheritdoc} 64 | */ 65 | public function getPerPage() 66 | { 67 | return $this->paginator->getPerPage(); 68 | } 69 | 70 | /** 71 | * {@inheritdoc} 72 | */ 73 | public function getUrl($page) 74 | { 75 | return $this->paginator->getPageURI($page); 76 | } 77 | 78 | /** 79 | * Get the paginator instance. 80 | * 81 | * @return \CodeIgniter\Pager\Pager 82 | */ 83 | public function getPaginator() 84 | { 85 | return $this->paginator; 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /app/Transformers/Status/StatusTransformer.php: -------------------------------------------------------------------------------- 1 | $status->id, 18 | 'status' => $status->status, 19 | 'created_at' => $status->created_at, 20 | 'updated_at' => $status->updated_at, 21 | ]; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /app/Views/BookView.php: -------------------------------------------------------------------------------- 1 | extend('partials/main') ?> 2 | 3 | section('content') ?> 4 | include('parts/modals')?> 5 |
6 |
7 |
8 |
9 |

CodeIgniter4 - DataTable Serverside with ajax crud

10 |
11 |
12 | 13 |
14 |
15 |
16 | 17 |
18 |
19 |
20 |
21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 |
NoTitleAuthorDescriptionStatusAction
34 |
35 |
36 |
37 |
38 |
39 | 40 |
41 |
42 | 43 |
44 | 45 | endSection() ?> 46 | 47 | 48 | section('extra-js') ?> 49 | 263 | endSection() ?> -------------------------------------------------------------------------------- /app/Views/errors/cli/error_404.php: -------------------------------------------------------------------------------- 1 | 4 | Message: 5 | Filename: getFile(), "\n"; ?> 6 | Line Number: getLine(); ?> 7 | 8 | 9 | 10 | Backtrace: 11 | getTrace() as $error) { ?> 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /app/Views/errors/cli/production.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 404 Page Not Found 6 | 7 | 70 | 71 | 72 |
73 |

404 - File Not Found

74 | 75 |

76 | 77 | 78 | 79 | Sorry! Cannot seem to find the page you were looking for. 80 | 81 |

82 |
83 | 84 | 85 | -------------------------------------------------------------------------------- /app/Views/errors/html/error_exception.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | <?= htmlspecialchars($title, ENT_SUBSTITUTE, 'UTF-8') ?> 9 | 12 | 13 | 16 | 17 | 18 | 19 | 20 |
21 |
22 |

getCode() ? ' #'.$exception->getCode() : '') ?>

23 |

24 | getMessage() ?> 25 | getMessage())) ?>" 26 | rel="noreferrer" target="_blank">search → 27 |

28 |
29 |
30 | 31 | 32 |
33 |

at line

34 | 35 | 36 |
37 | 38 |
39 | 40 |
41 | 42 |
43 | 44 | 53 | 54 |
55 | 56 | 57 |
58 | 59 |
    60 | $row) { ?> 61 | 62 |
  1. 63 |

    64 | 65 | 66 | 73 | 74 | {PHP internal code} 75 | 76 | 77 | 78 | 79 |   —   80 | 81 | 82 | ( arguments ) 83 |

    84 | 85 | 86 | getParameters(); 92 | } 93 | foreach ($row['args'] as $key => $value) { ?> 94 | 95 | 96 | 97 | 98 | 99 | 100 |
    name : "#$key", ENT_SUBSTITUTE, 'UTF-8') ?>
    101 |
    102 | 103 | () 104 | 105 | 106 | 107 | 108 |   —   () 109 | 110 |

    111 | 112 | 113 | 114 |
    115 | 116 |
    117 | 118 |
  2. 119 | 120 | 121 |
122 | 123 |
124 | 125 | 126 |
127 | 128 | 131 | 132 |

$

133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | $value) { ?> 143 | 144 | 145 | 152 | 153 | 154 | 155 |
KeyValue
146 | 147 | 148 | 149 | '.print_r($value, true) ?> 150 | 151 |
156 | 157 | 158 | 159 | 160 | 161 | 162 |

Constants

163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | $value) { ?> 173 | 174 | 175 | 182 | 183 | 184 | 185 |
KeyValue
176 | 177 | 178 | 179 | '.print_r($value, true) ?> 180 | 181 |
186 | 187 |
188 | 189 | 190 |
191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 |
Pathuri ?>
HTTP MethodgetMethod(true) ?>
IP AddressgetIPAddress() ?>
Is AJAX Request?isAJAX() ? 'yes' : 'no' ?>
Is CLI Request?isCLI() ? 'yes' : 'no' ?>
Is Secure Request?isSecure() ? 'yes' : 'no' ?>
User AgentgetUserAgent()->getAgentString() ?>
226 | 227 | 228 | 229 | 230 | 233 | 234 | 235 | 236 |

$

237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | $value) { ?> 247 | 248 | 249 | 256 | 257 | 258 | 259 |
KeyValue
250 | 251 | 252 | 253 | '.print_r($value, true) ?> 254 | 255 |
260 | 261 | 262 | 263 | 264 | 265 |
266 | No $_GET, $_POST, or $_COOKIE Information to show. 267 |
268 | 269 | 270 | 271 | getHeaders(); ?> 272 | 273 | 274 |

Headers

275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | $value) { ?> 285 | 288 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 |
HeaderValue
getName(), 'html') ?>getValueLine(), 'html') ?>
300 | 301 | 302 |
303 | 304 | 305 | setStatusCode(http_response_code()); 308 | ?> 309 |
310 | 311 | 312 | 313 | 314 | 315 |
Response StatusgetStatusCode().' - '.$response->getReason() ?>
316 | 317 | getHeaders(); ?> 318 | 319 | 320 | 321 |

Headers

322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | $value) { ?> 332 | 333 | 334 | 335 | 336 | 337 | 338 |
HeaderValue
getHeaderLine($name), 'html') ?>
339 | 340 | 341 |
342 | 343 | 344 |
345 | 346 | 347 |
    348 | 349 |
  1. 350 | 351 |
352 |
353 | 354 | 355 |
356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 |
Memory Usage
Peak Memory Usage:
Memory Limit:
373 | 374 |
375 | 376 |
377 | 378 |
379 | 380 | 391 | 392 | 393 | 394 | -------------------------------------------------------------------------------- /app/Views/errors/html/production.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Whoops! 8 | 9 | 12 | 13 | 14 | 15 |
16 | 17 |

Whoops!

18 | 19 |

We seem to have hit a snag. Please try again later...

20 | 21 |
22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /app/Views/partials/main.php: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | AdminLTE 3 | Top Navigation 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 | 32 | 57 | 58 | 59 | 60 |
61 | 62 |
63 |
64 |
65 |
66 |

Codeigniter4 Dashboard

67 |
68 |
69 | 73 |
74 |
75 |
76 |
77 | 78 | 79 | 80 |
81 |
82 | renderSection('content') ?> 83 |
84 |
85 | 86 |
87 | 88 | 89 | 90 |
91 | 92 |
93 | Page rendered in {elapsed_time} seconds. Environment: 94 |
95 | 96 | Copyright © Agung Sugiarto. All rights 97 | reserved. 98 |
99 |
100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | renderSection('extra-js') ?> 118 | 119 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /app/Views/parts/modals.php: -------------------------------------------------------------------------------- 1 | 2 | 39 | 40 | 41 | 78 | -------------------------------------------------------------------------------- /app/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "codeigniter4/appstarter", 3 | "type": "project", 4 | "description": "CodeIgniter4 starter app", 5 | "homepage": "https://codeigniter.com", 6 | "license": "MIT", 7 | "require": { 8 | "php": ">=7.2", 9 | "codeigniter4/framework": "^4", 10 | "fzaninotto/faker": "^1.9", 11 | "agungsugiarto/codeigniter4-cors": "^1.0", 12 | "agungsugiarto/codeigniter4-repository": "^1.0", 13 | "hashids/hashids": "^4.0", 14 | "spatie/fractalistic": "^2.9" 15 | }, 16 | "require-dev": { 17 | "mikey179/vfsstream": "1.6.*", 18 | "phpunit/phpunit": "^8.5" 19 | }, 20 | "scripts": { 21 | "post-update-cmd": [ 22 | "@composer dump-autoload" 23 | ], 24 | "test": "phpunit" 25 | }, 26 | "support": { 27 | "forum": "http://forum.codeigniter.com/", 28 | "source": "https://github.com/codeigniter4/CodeIgniter4", 29 | "slack": "https://codeigniterchat.slack.com" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /contributing.md: -------------------------------------------------------------------------------- 1 | # Contributing to CodeIgniter4 2 | 3 | 4 | ## Contributions 5 | 6 | We expect all contributions to conform to our style guide, be commented (inside the PHP source files), 7 | be documented (in the user guide), and unit tested (in the test folder). 8 | There is a [Contributing to CodeIgniter](./contributing/README.rst) section in the repository which describes the contribution process; this page is an overview. 9 | 10 | ## Issues 11 | 12 | Issues are a quick way to point out a bug. If you find a bug or documentation error in CodeIgniter then please check a few things first: 13 | 14 | 1. There is not already an open Issue 15 | 2. The issue has already been fixed (check the develop branch, or look for closed Issues) 16 | 3. Is it something really obvious that you can fix yourself? 17 | 18 | Reporting issues is helpful but an even [better approach](./contributing/workflow.rst) is to send a Pull Request, which is done by "Forking" the main repository and committing to your own copy. This will require you to use the version control system called Git. 19 | 20 | ## Guidelines 21 | 22 | Before we look into how, here are the guidelines. If your Pull Requests fail 23 | to pass these guidelines it will be declined and you will need to re-submit 24 | when you’ve made the changes. This might sound a bit tough, but it is required 25 | for us to maintain quality of the code-base. 26 | 27 | ### PHP Style 28 | 29 | All code must meet the [Style Guide](./contributing/styleguide.rst). 30 | This makes certain that all code is the same format as the existing code and means it will be as readable as possible. 31 | 32 | ### Documentation 33 | 34 | If you change anything that requires a change to documentation then you will need to add it. New classes, methods, parameters, changing default values, etc are all things that will require a change to documentation. The change-log must also be updated for every change. Also PHPDoc blocks must be maintained. 35 | 36 | ### Compatibility 37 | 38 | CodeIgniter4 requires PHP 7.2. 39 | 40 | ### Branching 41 | 42 | CodeIgniter4 uses the [Git-Flow](http://nvie.com/posts/a-successful-git-branching-model/) branching model which requires all pull requests to be sent to the "develop" branch. This is 43 | where the next planned version will be developed. The "master" branch will always contain the latest stable version and is kept clean so a "hotfix" (e.g: an emergency security patch) can be applied to master to create a new version, without worrying about other features holding it up. For this reason all commits need to be made to "develop" and any sent to "master" will be closed automatically. If you have multiple changes to submit, please place all changes into their own branch on your fork. 44 | 45 | One thing at a time: A pull request should only contain one change. That does not mean only one commit, but one change - however many commits it took. The reason for this is that if you change X and Y but send a pull request for both at the same time, we might really want X but disagree with Y, meaning we cannot merge the request. Using the Git-Flow branching model you can create new branches for both of these features and send two requests. 46 | 47 | ### Signing 48 | 49 | You must [GPG-sign](./contributing/signing.rst) your work, certifying that you either wrote the work or otherwise have the right to pass it on to an open source project. This is *not* just a "signed-off-by" commit, but instead a digitally signed one. 50 | 51 | ## How-to Guide 52 | 53 | The best way to contribute is to fork the CodeIgniter4 repository, and "clone" that to your development area. That sounds like some jargon, but "forking" on GitHub means "making a copy of that repo to your account" and "cloning" means "copying that code to your environment so you can work on it". 54 | 55 | 1. Set up Git (Windows, Mac & Linux) 56 | 2. Go to the CodeIgniter4 repo 57 | 3. Fork it (to your Github account) 58 | 4. Clone your CodeIgniter repo: git@github.com:\/CodeIgniter4.git 59 | 5. Create a new branch in your project for each set of changes you want to make. 60 | 6. Fix existing bugs on the Issue tracker after taking a look to see nobody else is working on them. 61 | 7. Commit the changed files in your contribution branch 62 | 8. Push your contribution branch to your fork 63 | 9. Send a pull request [http://help.github.com/send-pull-requests/](http://help.github.com/send-pull-requests/) 64 | 65 | The codebase maintainers will now be alerted about the change and at least one of the team will respond. If your change fails to meet the guidelines it will be bounced, or feedback will be provided to help you improve it. 66 | 67 | Once the maintainer handling your pull request is happy with it they will merge it into develop and your patch will be part of the next release. 68 | 69 | ### Keeping your fork up-to-date 70 | 71 | Unlike systems like Subversion, Git can have multiple remotes. A remote is the name for a URL of a Git repository. By default your fork will have a remote named "origin" which points to your fork, but you can add another remote named "codeigniter" which points to `git://github.com/codeigniter4/CodeIgniter4.git`. This is a read-only remote but you can pull from this develop branch to update your own. 72 | 73 | If you are using command-line you can do the following: 74 | 75 | 1. `git remote add codeigniter git://github.com/codeigniter4/CodeIgniter4.git` 76 | 2. `git pull codeigniter develop` 77 | 3. `git push origin develop` 78 | 79 | Now your fork is up to date. This should be done regularly, or before you send a pull request at least. 80 | -------------------------------------------------------------------------------- /license.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014-2019 British Columbia Institute of Technology 4 | Copyright (c) 2019 CodeIgniter Foundation 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /phpunit.xml.dist: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 14 | ./tests 15 | 16 | 17 | 18 | 19 | 20 | ./app 21 | 22 | ./app/Views 23 | ./app/Config/Routes.php 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /public/.htaccess: -------------------------------------------------------------------------------- 1 | # Disable directory browsing 2 | Options All -Indexes 3 | 4 | # ---------------------------------------------------------------------- 5 | # Rewrite engine 6 | # ---------------------------------------------------------------------- 7 | 8 | # Turning on the rewrite engine is necessary for the following rules and features. 9 | # FollowSymLinks must be enabled for this to work. 10 | 11 | Options +FollowSymlinks 12 | RewriteEngine On 13 | 14 | # If you installed CodeIgniter in a subfolder, you will need to 15 | # change the following line to match the subfolder you need. 16 | # http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritebase 17 | # RewriteBase / 18 | 19 | # Redirect Trailing Slashes... 20 | RewriteRule ^(.*)/$ /$1 [L,R=301] 21 | 22 | # Rewrite "www.example.com -> example.com" 23 | RewriteCond %{HTTPS} !=on 24 | RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] 25 | RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L] 26 | 27 | # Checks to see if the user is attempting to access a valid file, 28 | # such as an image or css document, if this isn't true it sends the 29 | # request to the front controller, index.php 30 | RewriteCond %{REQUEST_FILENAME} !-f 31 | RewriteCond %{REQUEST_FILENAME} !-d 32 | RewriteRule ^([\s\S]*)$ index.php/$1 [L,NC,QSA] 33 | 34 | # Ensure Authorization header is passed along 35 | RewriteCond %{HTTP:Authorization} . 36 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 37 | 38 | 39 | 40 | # If we don't have mod_rewrite installed, all 404's 41 | # can be sent to index.php, and everything works as normal. 42 | ErrorDocument 404 index.php 43 | 44 | 45 | # Disable server signature start 46 | ServerSignature Off 47 | # Disable server signature end 48 | -------------------------------------------------------------------------------- /public/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ronaldtech051/Codeigniter4-Ajax-CRUD/8d62575caffb98ebfa55e66955cb62fd738f92d0/public/1.png -------------------------------------------------------------------------------- /public/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ronaldtech051/Codeigniter4-Ajax-CRUD/8d62575caffb98ebfa55e66955cb62fd738f92d0/public/2.png -------------------------------------------------------------------------------- /public/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ronaldtech051/Codeigniter4-Ajax-CRUD/8d62575caffb98ebfa55e66955cb62fd738f92d0/public/3.png -------------------------------------------------------------------------------- /public/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ronaldtech051/Codeigniter4-Ajax-CRUD/8d62575caffb98ebfa55e66955cb62fd738f92d0/public/4.png -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ronaldtech051/Codeigniter4-Ajax-CRUD/8d62575caffb98ebfa55e66955cb62fd738f92d0/public/favicon.ico -------------------------------------------------------------------------------- /public/index.php: -------------------------------------------------------------------------------- 1 | systemDirectory, '/ ').'/bootstrap.php'; 36 | 37 | /* 38 | *--------------------------------------------------------------- 39 | * LAUNCH THE APPLICATION 40 | *--------------------------------------------------------------- 41 | * Now that everything is setup, it's time to actually fire 42 | * up the engines and make this app do its thang. 43 | */ 44 | $app->run(); 45 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /public/session/ci_session8c1grs9pv7rbtqb3as5oakipi3n42vsd: -------------------------------------------------------------------------------- 1 | __ci_last_regenerate|i:1578742035;_ci_previous_url|s:26:"http://crud.ci4.local/test"; -------------------------------------------------------------------------------- /public/session/ci_sessiond73p4e53t1tkac5usopmc9ktmqhgbv4q: -------------------------------------------------------------------------------- 1 | __ci_last_regenerate|i:1578742035;_ci_previous_url|s:26:"http://crud.ci4.local/test"; -------------------------------------------------------------------------------- /public/writeable/session/ci_session8c1grs9pv7rbtqb3as5oakipi3n42vsd: -------------------------------------------------------------------------------- 1 | __ci_last_regenerate|i:1578742079;_ci_previous_url|s:26:"http://crud.ci4.local/test"; -------------------------------------------------------------------------------- /spark: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | systemDirectory, '/ ') . '/bootstrap.php'; 45 | 46 | // Grab our Console 47 | $console = new \CodeIgniter\CLI\Console($app); 48 | 49 | // We want errors to be shown when using it from the CLI. 50 | error_reporting(-1); 51 | ini_set('display_errors', 1); 52 | 53 | // Show basic information before we do anything else. 54 | $console->showHeader(); 55 | 56 | // fire off the command in the main framework. 57 | $response = $console->run(); 58 | if ($response->getStatusCode() >= 300) 59 | { 60 | exit($response->getStatusCode()); 61 | } 62 | -------------------------------------------------------------------------------- /writable/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | Require all denied 3 | 4 | 5 | Deny from all 6 | 7 | -------------------------------------------------------------------------------- /writable/cache/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /writable/logs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /writable/uploads/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | --------------------------------------------------------------------------------