codeigniter 11

Codeigniter 4馃敟 [11.- model,insert,update,save]

En este tutorial vamos a trabajar con la base de datos, con los modelos y registros, pero en particular vamos a crear, y actualizar registros de a forma tan facil y sencilla que nos entrega codeigniter4.

Codeigniter 4? [11.- model,insert,update,save]

Codigo en github.com: https://github.com/programadornovato/codeigniter4/commit/806620237c14a60ccb039eed10ebbbc13a22b749

//app/Controllers/Home.php
<?php namespace App\Controllers;

use CodeIgniter\Controller;
use App\Models\UserModel;

class Home extends BaseController
{
	public function index()
	{
		$userModel=new UserModel($db);
		//$users=$userModel->find([1,2]);
		//$users=$userModel->findAll();
		//$users=$userModel->where('name','maria')->findAll();
		//$users=$userModel->findAll(2,3);
		//$users=$userModel->withDeleted()->findAll();
		$users=$userModel->onlyDeleted()->findAll();
		$users=array('users'=>$users);
		$estructura=view('estructura/header').view('estructura/body',$users);
		return $estructura;
	}

	//--------------------------------------------------------------------

}





//app/Views/estructura/body.php 
<body>
    <table>
    <tr>
    <th>name</th>
    <th>email</th>
    <th>deleted</th>
    </tr>
    <?php
    foreach($users as $user){
        echo "<tr>";
        echo "<td>".$user['name']."</td>";
        echo "<td>".$user['email']."</td>";
        echo "<td>".$user['deleted']."</td>";
        echo "</tr>";
    }
    ?>
    </table>
</body>
</html>

#Codeigniter4 #php7 #backend #Codeigniter #php .
? Esta lista de reproducci贸n: https://www.youtube.com/playlist?list=PLCTD_CpMeEKTFN5TDeOP-wP_hU0_9VoWg
.
Codigos en gdrive: https://drive.google.com/file/d/1awbG6jI40IO0N68fgjLUwNFpsTC3wIHj/view?usp=sharing .
Gracias por apoyar este canal: https://www.patreon.com/programadornovato?fan_landing=true .
? Facebook: https://facebook.com/ProgramadorNovatoOficial
? Twitter: https://twitter.com/programadornova
? Linkedin: https://www.linkedin.com/in/programadornovato/
? Instagram: https://www.instagram.com/programadornovato/

Deja un comentario

Tu direcci贸n de correo electr贸nico no ser谩 publicada. Los campos obligatorios est谩n marcados con *