Route::get PHP Method

get() public static method

Register a new GET route with the router.
public static get ( string $uri, Closure | array | string | null $action = null ) : Illuminate\Routing\Route
$uri string
$action Closure | array | string | null
return Illuminate\Routing\Route
        public static function get($uri, $action = null)
        {
            return \Illuminate\Routing\Router::get($uri, $action);
        }

Usage Example

Example #1
0
 public function action_index()
 {
     $username = $this->request->param('username');
     $this->view = new View_Message_Create();
     $this->view->username = $username;
     if ($this->request->method() == HTTP_Request::POST) {
         try {
             $post = $this->request->post();
             $receiver = ORM::factory('User')->where('username', '=', $post['receiver'])->find();
             if (!$receiver->loaded()) {
                 return Hint::error('Cannot find a user with the username: '******'You cannot send a message to yourself!');
             }
             $message_data = Arr::merge($this->request->post(), array('sender_id' => $this->user->id, 'receiver_id' => $receiver->id));
             $message = ORM::factory('Message')->create_message($message_data, array('receiver_id', 'subject', 'content', 'sender_id'));
             $message_data_sent = Arr::merge($this->request->post(), array('receiver_id' => $this->user->id, 'sender_id' => $receiver->id, 'sent' => 1, 'read' => 1));
             ORM::factory('Message')->create_message($message_data_sent, array('receiver_id', 'subject', 'content', 'sender_id', 'sent', 'read'));
             Hint::success('You have sent a message');
             $this->redirect(Route::get('message.inbox')->uri());
         } catch (ORM_Validation_Exception $e) {
             Hint::error($e->errors('models'));
         }
     }
 }
All Usage Examples Of Route::get