A
A
Anton2019-11-11 08:00:42
Kohana
Anton, 2019-11-11 08:00:42

Framework kohana, problems with the route, how to fix it?

Greetings my brainy super mind.
I know that the kohana is outdated long ago, so you can not write about it in a comment.
Route problem.
The URL is: site/agent/moizajavki/
Does not enter.
Route

Route::set('moizajavki', 'moizajavki(/<controller>(/<action>(/<id>(/<page>))))')
  ->defaults(
  array(
    'directory'  => 'index',
    'controller' => 'agent',
    'action'     => 'moizajavki',
  )
);

How everything works.
/classes/controller/index
in it, agent.php
And there
<?php defined('SYSPATH') or die('No direct script access.');

class Controller_Index_Agent extends Controller_Agent
{

  public function action_index()
  {
    $id = (int)$this->request->param("id");
    $agents = ORM::factory('agent')
      ->where('id', '=', $id)
      ->find();

    if (isset($_POST['submit']))
    {
      $data = Arr::extract(
        $_POST, array(
          'title',
          'keywords',
          'description',
        )
      );
      $agents->values($data);
      $agents->save();
    }
    $content = View::factory('index/agent')
      ->bind('agent', $agents)
      ->bind('id', $id);

    $this->template->site_name = 'Личный кабинет агента';
    $this->template->content = $content;
  }

  public function action_moizajavki()
  {
    $id = $this->request->param("id");
    $zajavkis = ORM::factory('zajavki')
      ->where('id', '=', $id)
      ->find();

    $content = View::factory('index/agent/moizajavki')
      ->bind('zajavki', $zajavkis)
      ->bind('id', $id);

    $this->template->site_name = 'Мои заявки';
    $this->template->content = $content;
  }
}

Where did I make a mistake?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question