millas 0.2.25 → 0.2.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "millas",
3
- "version": "0.2.25",
3
+ "version": "0.2.26",
4
4
  "description": "A modern batteries-included backend framework for Node.js — built on Express, inspired by Laravel, Django, and FastAPI",
5
5
  "main": "src/index.js",
6
6
  "exports": {
@@ -569,6 +569,10 @@ class Model {
569
569
  return new QueryBuilder(this._db(), this).select(...cols);
570
570
  }
571
571
 
572
+ static selectRaw(sql, bindings = []) {
573
+ return new QueryBuilder(this._db(), this).selectRaw(sql, bindings);
574
+ }
575
+
572
576
  static distinct(...cols) {
573
577
  return new QueryBuilder(this._db(), this).distinct(...cols);
574
578
  }
@@ -78,6 +78,12 @@ class RouteEntry {
78
78
  * Add extra middleware to this specific route after registration.
79
79
  * Middleware aliases are appended to the existing list.
80
80
  *
81
+ * Supports Laravel-style parameters:
82
+ * .middleware('auth')
83
+ * .middleware(['auth', 'throttle'])
84
+ * .middleware('verifyAction:payment_method_delete')
85
+ * .middleware(['auth', 'verifyAction:payment_method_delete'])
86
+ *
81
87
  * @param {string|string[]} middleware
82
88
  * @returns {RouteEntry}
83
89
  */
@@ -86,6 +92,18 @@ class RouteEntry {
86
92
  this._entry.middleware = [...(this._entry.middleware || []), ...list];
87
93
  return this;
88
94
  }
95
+
96
+ /**
97
+ * Set route name (Laravel-style).
98
+ * Route.get('/users', UserController, 'index').name('users.index')
99
+ *
100
+ * @param {string} name
101
+ * @returns {RouteEntry}
102
+ */
103
+ name(name) {
104
+ this._entry.name = name;
105
+ return this;
106
+ }
89
107
  }
90
108
 
91
109
  module.exports = RouteEntry;