Is there anyway to physically delete a database record when usesoftdeletes == true? Can usesoftdeletes be overidden temporarily?
Thank you!
Thank you!
$routes->cli('cli/postbyid/(:segment)/(:segment)/(:any)', 'Cli::postbyid/$1/$2/$3');
php index.php cli param1 param2 param3(b)CodeIgniter\HTTP\Exceptions\BadRequestException: The URI you submitted has disallowed characters: "param3(b)"<?php
use CodeIgniter\Router\RouteCollection;
/**
* @var RouteCollection $routes
*/
require 'Routes_vetrina.php';
require 'Routes_gestionale.php';<?php
############################################################################################################
############################################################################################################
# GESTIONALE
############################################################################################################
############################################################################################################
/*
* --------------------------------------------------------------------
* AUTH
* --------------------------------------------------------------------
*/
service('auth')->routes($routes); //line 19composer audit
The new audit.abandoned setting (currently defaulting to "report" will default to "fail" in Composer 2.7, make sure to set it to "report" or "ignore" explicitly by then if you do not want this.
Found 1 security vulnerability advisory affecting 1 package:
+-------------------+----------------------------------------------------------------------------------+
| Package | codeigniter4/framework |
| CVE | CVE-2025-24013 |
| Title | Missing validation of header name and value in codeigniter4/framework |
| URL | https://github.com/advisories/GHSA-x5mq-jjr3-vmx6 |
| Affected versions | <4.5.8 |
| Reported at | 2025-01-21T21:13:40+00:00 |
+-------------------+----------------------------------------------------------------------------------+<?php
namespace App\Controllers;
use App\Controllers\BaseController;
use App\Models\UserModel;
class Login extends BaseController
{
public function index()
{
return view('login');
}
public function authenticate()
{
$session = session();
$userModel = new UserModel();
$email = $this->request->getVar('email');
$password = $this->request->getVar('password');
$user = $userModel->where('user_email', $email)->first();
if(is_null($user)) {
return redirect()->back()->withInput()->with('error', 'Invalid username or password.');
}
$pwd_verify = password_verify($password, $user['user_pass']);
if(!$pwd_verify) {
return redirect()->back()->withInput()->with('error', 'Invalid username or password.');
}
$ses_data = [
'user_id' => $user['user_id'],
'user_email' => $user['user_email'],
'isLoggedIn' => TRUE
];
$session->set($ses_data);
$data = array("js_to_load"=> "hello");
//$data['js_to_load']=array("https://cdn.datatables.net/2.2.2/js/dataTables.js","https://cdn.datatables.net/2.2.2/js/dataTables.tailwindcss.js");
return view( '/dashboard', $data);
}
}<?=$this->extend("layouts/postlogin_layout")?>
<?=$this->section("content")?>
<?php echo $js_to_load; ?>
<?=$this->include('partials/usersettings');?>
<?=$this->endSection()?>Quote:ErrorException - Undefined variable $js_to_loadI have tried everything ..
$this->load->view('/dashboard',$data);
return view( '/dashboard', $data);
echo view('dashboard', $data);print_r($_SESSION);Fatal error : Uncaught ErrorException: touch(): cannot create file
writable/session/ci_session7b2atemvbopvjl3vim2mdfcaviebofii
because C:\xampp\htdocs\htdocks\work\system\Session\Handlers\FileHandler.phFileHandler.php(193):
touch('writable/sessio...')#2 [internal function]:
CodeIgniter\Session\Handlers\FileHandler->write('7b2atemvbopvjl3...',' ' ''__________ [instead of][
C:\xampp\htdocs\htdocks\vendor\codeigniter4\framework\system\Session\Handlers\FileHandler.php even 193
The folders exist and even create the file it says but I get this error<title><?= esc($title ?? 'Default Title') ?></title>PHP Fatal error: Uncaught Error: Call to undefined function esc() in /var/www/mvc/xa/app/Views/templates/xaHeader.php:7
Stack trace:
#0 {main}
thrown in /var/www/mvc/xa/app/Views/templates/xaHeader.php on line 7 $data['is_new'] = $is_new;
return view('my_body', $data);<?php
?>
if ($is_new) {
<?php
print "Welcome, new user.";
?>
} else {
print "Welcome back.";
}
<?php
namespace app\Controllers;
use CodeIgniter\Test\CIUnitTestCase;
use CodeIgniter\Test\FeatureTestTrait;
use CodeIgniter\Test\DatabaseTestTrait;
use PHPUnit\Framework\Attributes\TestDox;
class MyControllerFeaturesTest extends CIUnitTestCase
{
use FeatureTestTrait;
use DatabaseTestTrait;
/**
* setup and teardown run before and after
* the _entire_ test case
* setup and tearDown run _between_ tests
*/
public static function setUpBeforeClass(): void
{
parent::setUpBeforeClass();
}
public static function tearDownAfterClass(): void
{
parent::tearDownAfterClass();
}
protected function setUp(): void
{
parent::setUp(); // Do not forget
helper('text');
}
protected function tearDown(): void {
parent::tearDown();
}
#[TestDox('A new user should get a welcome')]
public function testViewingResults(): void
{
$response = $this->get('/forum/loggedin/79435')
->call();
$response->assertSee('Welcome, new user');
}
}
ErrorException: Undefined variable $is_new protected function execute(string $sql)
{
while ($this->connID->more_results()) {
$this->connID->next_result();
if ($res = $this->connID->store_result()) {
$res->free();
}
}
try {
return $this->connID->query($this->prepQuery($sql), $this->resultMode);
} catch (mysqli_sql_exception $e) {
log_message('error', (string) $e);
if ($this->DBDebug) {
throw new DatabaseException($e->getMessage(), $e->getCode(), $e);
}
}
return false;
}
bootstrap="system/Test/bootstrap.php"
bootstrap="vendor/codeigniter4/framework/system/Test/bootstrap.php"
public array $groups = [
'superadmin' => [
'title' => 'Super Admin',
'description' => 'Optional description of the group.',
],
];
public array $permissions = [
'admin.access' => 'Can access the sites admin area',
'admin.settings' => 'Can access the main site settings',
'users.manage-admins' => 'Can manage other admins',
'users.create' => 'Can create new non-admin users',
'users.edit' => 'Can edit existing non-admin users',
'users.delete' => 'Can delete existing non-admin users',
'beta.access' => 'Can access beta-level features'
];
try {
$Model->insertBatch($data);
}catch (Exception $e){
echo $e->getMessage();
}
$Model->insertBatch($data);
if($Model->error()['message']>''){
var_dump($Model->error()['message']);
}
$data = [];
$data[] = ['name'=>'Hans','wert'=>1];
for($i=0;$i<5000;$i++){
$data[] = ['name'=>'Tom_1'.$i,'wert'=>1];
}
$data[] = ['name'=>'Hans','wert'=>1];
for($i=0;$i<5000;$i++){
$data[] = ['name'=>'Tom_2'.$i,'wert'=>1];
}
'myDateTime' => 'required|valid_date["Y-m-d H:i"]',
composer create-project codeigniter4/appstarter phpwww
└── lab/
└── php/ (project folder)
└── public/app.baseURL = 'http://localhost/lab/php/'<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
<FilesMatch "^\.">
Require all denied
</FilesMatch>www
└── lab/
└── php/ (project folder)
├── .htaccess
└── public/$routes->get('client', 'ClientController::index');
$routes->get('client/(:segment)', 'ClientController::show/$1');
$routes->post('client', 'ClientController::create');
$routes->put('client/(:segment)', 'ClientController::update/$1');
$routes->patch('client/(:segment)', 'ClientController::update/$1');
$routes->delete('client/(:segment)', 'ClientController::delete/$1');