Witam,
Walczę z przekazaniem wartosci slug do modelu.
Skonfigurowałem już plik routes.php

 

$route['ogloszenia/edytuj/(:any)'] = 'ogloszenia/edytuj/$1';

moja akcja z kontrollera ogloszenia.php

 public function edytuj($slug = NULL) {

        $this->form_validation->set_error_delimiters('<div>', '</div>');
        $this->form_validation->set_rules('description', 'description', 'trim|required|min_length[2]|max_length[255]|xss_clean');
        $this->form_validation->set_rules('price', 'price', 'trim|numeric|required|xss_clean');
        
        $this->form_validation->set_rules('time_when', 'time_when', 'required');
        $this->form_validation->set_rules('time_h', 'time_h', 'required');
        $this->form_validation->set_rules('time_m', 'time_m', 'required');
        
        $this->form_validation->set_rules('time_off', 'time_off', 'required');
        $this->form_validation->set_rules('time_h_confirmation', 'time_h_confirmation', 'required');
        $this->form_validation->set_rules('time_m_confirmation', 'time_m_confirmation', 'required');

        
        if ($this->form_validation->run() == FALSE) {
            $this->load->view('home/head');
            $this->load->view('home/navbar_home');
             $this->load->view('forms/edit_dish_form');
            $this->load->view('home/footer');
        } else {

            $time_when = $this->input->post('time_when');
            $h = $this->input->post('time_h');
            $m = $this->input->post('time_m');
            $time_when = $time_when . ' ' . $h . ':' . $m;

            $time_off = $this->input->post('time_off');
            $h_c = $this->input->post('time_h_confirmation');
            $m_c = $this->input->post('time_m_confirmation');
            $time_off = $time_off . ' ' . $h_c . ':' . $m_c;

            $id_user = $this->tank_auth->get_user_id();
             $city = $this->profile_model->get_user_city($id_user);

            $data = array(
                
                'city' => $city,
                'id_user' => $id_user,
                'id_photo' => $this->profile_model->get_image_path(),
                'description' => $this->input->post('description'),
                'price' => $this->input->post('price'),
                'time_when' => $time_when,
                'time_off' => $time_off,
                'slug' => $slug,   // tu przekazuje niby NULL ??
            );
            $this->ad_model->update_dish_model($data);
            //Loading View
            $this->load->view('home/success');
            redirect(base_url('/'));
            $this->load->view('home/footer');
        }


 

akcja z modelu:

  function update_dish_model($data){


      $slug =  $data['slug'];
      $this->db->where('id',$slug);
         $this->db->replace('ci_charts', $data);
        return true;
   
 
    }

 

Dodam że wszystko działa oprócz tego sluga.
Nie ustawiłem filtrów poprawnie wiem ale na razie musi działać model....

Proszę was o pomoc