Tuesday, April 16, 2024
HomePHPExport Eloquent Fashions to JSON Information

Export Eloquent Fashions to JSON Information


Mannequin JSON for Laravel is a package deal that means that you can simply export information from particular fashions in your Laravel software to JSON format. It’s based mostly on the php artisan command and provides varied choices to customise the export course of. This package deal helps export essential information out of your fashions in a handy format:

php artisan mannequin:export Consumer

 

# Or specify the precise mannequin location

php artisan mannequin:export AppModelsUser

 

# Exclude fields

php artisan mannequin:export Consumer --except-fields=id,deleted_at

This package deal additionally helps related mannequin information utilizing the next flag:

php artisan mannequin:export Product

--with-relationships=class

 

# Like earlier than, specify which fields to export

# on the connection

php artisan mannequin:export Product

--with-relationships=class:id,title

Lastly, you may import information from a JSON file and retailer it in your database:

php artisan mannequin:import Consumer path/to/Customers.json

You possibly can study extra about this package deal, get full set up directions, and consider the supply code on GitHub.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments