Download the PHP package yudhees/laravel-vue-controller without Composer
On this page you can find all versions of the php package yudhees/laravel-vue-controller. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download yudhees/laravel-vue-controller
More information about yudhees/laravel-vue-controller
Files in yudhees/laravel-vue-controller
Package laravel-vue-controller
Short Description To Access Laravel Controller Inside a vue file
License MIT
Informations about the package laravel-vue-controller
laravel-vue-controller - To access your controller within a vue file
[!NOTE] Welcome To laravel-vue-controller , I request you to read the below documentation clearly
Installation
Composer
composer require yudhees/laravel-vue-controller
or
Begin by installing this package through Composer. Edit your project's composer.json file to require yudhees/laravel-vue-controller.
"require-dev": {
"yudhees/laravel-vue-controller": "1.5"
}
Next, update Composer from the Terminal:
composer update
[!NOTE]
if You are using Laravel > 4 Skip the below step because The service provider is auto discover then no need to register this provider
Laravel <=4
Once this operation completes, the final step is to add the service provider. Open config/app.php, and add a new item to the providers array.
Yudhees\LaravelVueController\vuecontrollerserviceprovider::class
Note
The service Provider Contains the Default Route , Be Sure that This Route is not registered in any of your route file
Route::post('/vuecontroller',vuecontroller::class)->name('vuecontroller');
Usage
[!NOTE] In This Example I am using Inertia.js
In Your app.js file simply add this
import {controller} from '../../vendor/yudhees/laravel-vue-controller/compostables/global.js'
app.js
Global
Two Ways to Inject controller function to vue Components
Provide/Inject
or
Global Properties
Controller Fucntion
Controller Function Accepts Two Arguments The First Argument Represents Path of the Controller
controller(controllerPath,functionname,params={})
[!NOTE] Default prefix path of the Controller is
App\Http\Controller
Example
I Created a UserController using This Command
php artisan make:controller UserController
The Example UserController is Look Like this
Vue Template
userslist.vue
Scripts
Composition api vue 3 (Provide/Inject)
Option API (Global Properties)
Vendor Files
vuecontroller.php file
License
laravel-vue-controller is open-source software released under the MIT license. See LICENSE for more information.