public static function url_for($options, $type = 'url') { if (is_string($options)) { return $options; } else { if ($options instanceof ORM) { $model = $options; $route = [$model->loaded() ? $model->object_name() : $model->object_plural(), $type]; $route = implode('_', $route); return Route::__callStatic($route, [$options]); // forward_static_call_array(['Route', $route], [$options]); } else { if (is_array($options)) { // check if we got a collection of objects or key-value array if (isset($options[0])) { $route = []; foreach ($options as $model) { if ($model instanceof ORM) { $route[] = $model->loaded() ? $model->object_name() : $model->object_plural(); } else { $route[] = $model; } } $route[] = $type; $route = implode('_', $route); return Route::__callStatic($route, $options); // forward_static_call_array(['Route', $route], [$options]); } else { Route::default_path($options); } } } } }