snowair / phalcon-debugbar

A powerful debug and profilers tool for the Phalcon Framework
MIT License
162 stars 49 forks source link

Call to undefined method App\Middleware\Url::getStatic() #50

Open ridwanskaterock opened 6 years ago

ridwanskaterock commented 6 years ago

i have problem with this library

see my ss image

code of Url


<?php
namespace App\Middleware;

/*
|--------------------------------------------------------------------------
| Database Provider
|--------------------------------------------------------------------------
|
| This value is the name of your application. This value is used when the
| framework needs to place the application's name in a notification or
| any other location as required by the application or its packages.
*/

use \Phalcon\Mvc\Url as PhalconUrl;
use \Phalcon\Mvc\User\Component;

class Url extends Component
{
    /**
     * Url Instance
     *
     */
    protected static $url;

    /**
     * Define base url
     *
     */
    function __construct()
    {
        $config     = $this->di['config']->app;
        $url        = new PhalconUrl;

        $url->setBaseUri($config->base_url);

        self::$url = $url;
    }

    /**
     * Base Url
     *
     */
    public static function get($path = '', $args = null, $local = true)
    {
        return self::$url->get($path, $args, $local);
    }

    /**
     * Asset Url
     *
     */
    public static function asset($path = '', $args = null, $local = true)
    {
        return self::$url->get('public/' . $path, $args, $local);
    }

}

thanks

snowair commented 6 years ago

user-defined url service must extend from the \Phalcon\Mvc\Url class.