Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter 3 to 4 Upgrade Helper
#1

Hi, everyone.

I started to develop a tool which reduces upgrade costs from CodeIgniter3 to CodeIgniter4.

https://github.com/kenjis/ci3-to-4-upgrade-helper

This project is under early development.

It provides compatible interfaces for common use cases in CodeIgniter3 apps.
You can run the following code on CodeIgniter4.
PHP Code:
<?php
namespace App\Models;

use 
Kenjis\CI3Compatible\Core\CI_Model;

class 
News_model extends CI_Model
{
    public function __construct()
    {
        parent::__construct();

        $this->load->database();
    }

    public function get_news($slug false)
    {
        if ($slug === false) {
            $query $this->db->get('news');
            return $query->result_array();
        }

        $query $this->db->get_where('news', ['slug' => $slug]);
        return $query->row_array();
    }

    public function set_news()
    {
        $this->load->helper('url');

        $slug url_title($this->input->post('title'), '-'true);

        $data = [
            'title' => $this->input->post('title'),
            'slug'  => $slug,
            'text'  => $this->input->post('text')
        ];

        return $this->db->insert('news'$data);
    }

Reply


Messages In This Thread
CodeIgniter 3 to 4 Upgrade Helper - by kenjis - 02-08-2021, 01:45 AM
RE: CodeIgniter 3 to 4 Upgrade Helper - by kenjis - 02-10-2021, 10:49 PM
RE: CodeIgniter 3 to 4 Upgrade Helper - by kenjis - 02-19-2021, 01:10 AM
RE: CodeIgniter 3 to 4 Upgrade Helper - by kenjis - 02-21-2021, 04:20 PM
RE: CodeIgniter 3 to 4 Upgrade Helper - by kenjis - 03-18-2021, 11:06 PM



Theme © iAndrew 2016 - Forum software by © MyBB