phalcon-debugbar icon indicating copy to clipboard operation
phalcon-debugbar copied to clipboard

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

Open ridwanskaterock opened this issue 7 years ago • 1 comments

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

ridwanskaterock avatar Nov 29 '17 15:11 ridwanskaterock

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

snowair avatar Nov 30 '17 08:11 snowair