has_url
trait has_url
Trait has_url.
Provides instance methods for entities to generate their own URLs. Delegates strictly to the central Facade.
Architecture Note: While strict DDD separates routing from entities, in the Moodle/ActiveRecord context, self-generating URLs facilitates template rendering and ease of use.
Methods
moodle_url
get_url(string $action = 'view', array $params = [])
Get the URL for a specific action on this entity.
moodle_url
get_view_url()
Shortcut for the view URL.
moodle_url
get_edit_url()
Shortcut for the edit URL.
moodle_url
get_webhook_url(string $action, array $params = [])
Generate a webhook URL specific to this entity.
Details
at line 46
moodle_url
get_url(string $action = 'view', array $params = [])
Get the URL for a specific action on this entity.
Convention: Route name is "middag.{type}.{action}" Example: $item->get_url('edit') -> route('middag.generic.edit', ['id' => 123])
at line 71
moodle_url
get_view_url()
Shortcut for the view URL.
at line 79
moodle_url
get_edit_url()
Shortcut for the edit URL.
at line 92
moodle_url
get_webhook_url(string $action, array $params = [])
Generate a webhook URL specific to this entity.