This is because of Node Sass.
I got this error in ubuntu machine while running a command npm run prod
Vue packages version mismatch:
Though the version of the Vue-template-compiler is older than that of the Vue I just updated it to same version number as the Vue thus 2.6.11 In your case the number might not be same as mine so replace the version which shows in your error.
Once you start deploying your Laravel application you may see this error in your terminal while installing npm.
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/opt/lampp/htdocs/mhn-hospitals-profile-ms/node_modules/node-sass/build'
In addition to generating resources that transform individual models, you may generate resources that are responsible for transforming collections of models. This allows your response to include links and other meta information that is relevant to an entire collection of a given resource.
Collection resources extend the Illuminate\Http\Resources\Json\ResourceCollection class:
In previoes lessons we have seen how to generate json data of single object. Now we are going to see how to generatet Collection of Objects.
How to generate customized Json data using resource in Laravel with some additional information?
In Our previous tutorial we have seen how to generate customized Json data in which we had generated 2 field values from
User
tabel of database.
Now, Assuming Requirement: I need a json data of User Table along with below aditional data like
- Virsion
- attribution
In Our previous tutorial we have seen how to generate json data in which we just did a Direct Map of our User database table.
Now, We are going to play arround Json data as per our requirement. Every Time Requirements will be diffrent Right...... So we are gona generate different numbers of data in many ways... Just go for it Guys...!
LARAVEL's resource classes allow you to expressively and easily transform your models and model collections into JSON.Basically you can generate a nice json formatted data right from Eloquent. Laravel's resource classes allow you to expressively and easily transform your models and model collections into JSON. Let’s learn how to generate api resources.Consider you have a user table in your database and you want to generate api resources for your User model.Run following command on your terminal window while being on laravel project root directory:
- Run this Command to generate a resource class.
- By default, resources will be placed in the
app/Http/Resources
directory of your application. Resources extend theIlluminate\Http\Resources\Json\JsonResource
class:
LARAVEL already makes it easy to perform authentication via traditional login forms, but what about APIs? APIs typically use tokens to authenticate users and do not maintain session state between requests. Laravel makes API authentication a breeze using Laravel Passport, which provides a full OAuth2 server implementation for your Laravel application in a matter of minutes. Passport is built on top of the League OAuth2 server that is maintained by Alex Bilbie.
install Passport via the Composer package manager:
composer require laravel/passport=~4.0
The Passport service provider registers its own database migration directory with the framework, so you should migrate your database after registering the provider. The Passport migrations will create the tables your application needs to store clients and access tokens: