charlgottschalk / vueloquent
Vueloquent brings Laravel's DB queries to the front-end.
Installs: 6
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 21
Language:JavaScript
- dev-master
- 0.0.3
- 0.0.2
- v0.0.1
- dev-dependabot/npm_and_yarn/js/json5-1.0.2
- dev-dependabot/npm_and_yarn/js/express-4.18.2
- dev-dependabot/npm_and_yarn/js/qs-and-express-6.11.0
- dev-dependabot/npm_and_yarn/js/decode-uri-component-0.2.2
- dev-dependabot/npm_and_yarn/js/loader-utils-1.4.2
- dev-dependabot/npm_and_yarn/js/eventsource-1.1.1
- dev-dependabot/npm_and_yarn/js/url-parse-1.5.10
- dev-dependabot/npm_and_yarn/js/follow-redirects-1.14.8
- dev-dependabot/npm_and_yarn/js/ajv-6.12.6
- dev-dependabot/npm_and_yarn/js/path-parse-1.0.7
- dev-dependabot/npm_and_yarn/js/dns-packet-1.3.4
- dev-dependabot/npm_and_yarn/js/browserslist-4.16.6
- dev-dependabot/npm_and_yarn/js/lodash-4.17.21
- dev-dependabot/npm_and_yarn/js/ssri-6.0.2
- dev-dependabot/npm_and_yarn/js/y18n-4.0.1
- dev-dependabot/npm_and_yarn/js/elliptic-6.5.4
- dev-dependabot/npm_and_yarn/js/axios-0.21.1
- dev-dependabot/npm_and_yarn/js/ini-1.3.7
- dev-dependabot/npm_and_yarn/js/http-proxy-1.18.1
- dev-dependabot/npm_and_yarn/js/websocket-extensions-0.1.4
- dev-dependabot/npm_and_yarn/js/mixin-deep-1.3.2
This package is auto-updated.
Last update: 2024-03-30 00:21:08 UTC
README
Vueloquent brings Laravel's query builder to the front-end as a Vue plugin or plain JavaScript module, providing the same convenient, fluent interface for creating and running database queries all while using a single route to handle queries for all models.
Example:
Vue.eloquent.token('api_token').at('endpoint').from('User').find(1);
or
$v .token('api_token') .at('endpoint') .from('User') .with('posts') .where('published', true) .get();
Requirements
- PHP 7.1+
- Laravel 5.6+
Installation
- Install the package by running this command in your terminal/cmd:
composer require charlgottschalk/vueloquent
- Publish the Vueloquent plugin
If you're using Vue
php artisan vendor:publish --tag=vueloquent-vue
Include the self-installing plugin after Vue.
<script src="/js/app.js"></script> <script src="/js/vendor/vueloquent/vueloquent.plugin.js"></script>
Once loaded, you will be able to access Vueloquent globally in your Vue instances at Vue.eloquent
.
If you're using plain JavaScript
php artisan vendor:publish --tag=vueloquent-js
Include the script before your closing </body>
tag.
<script src="/js/vendor/vueloquent/vueloquent.plain.js"></script>
Once loaded, you will be able to access Vueloquent at $v
.
Route Setup
You will need to create a post
route that will handle all Vueloquent queries. I suggest creating an api route in your routes\api.php
file.
use Illuminate\Http\Request; use CharlGottschalk\Vueloquent\VueloquentHandler; Route::middleware('auth:api')->post('[vueloquent_route]', function (Request $request, VueloquentHandler $handler) { return $handler->handle($request); });
Replace [vueloquent_route]
with the endpoint you wish.
Documentation
For more in-depth documentation, please visit the wiki.
To Do:
- Query Denials
- Authorization Handling
License
This project is licensed under the MIT License - see the LICENSE file for details