Sharing Laravel Eloquent Models Between Multiple Forked Repositories is possible? - laravel

In my Laravel project, I have different types of modules like employee, customer & vendor modules. Recently I split each module into a separate repository. Now if I adding a Model means, I need to duplicate it other repositories also. Is there is any possibility to overcome this?
Is there is any possibility to sync/share the Models folder with other repositories also?
Kindly help me to fix this.
FYI - I'm using Bitbucket for my repositories.

I'd make a composer package out of these models so that you can require them in the application. Recently, I found a documentation on laravel packages: https://laravelpackage.com/

Related

Laravel e-commerce project using Aimeos package

I'm trying to work on a Laravel e-commerce project where I'm planning on using the Aimeos package for a multi-vendor platform with a front-end custom theme. However, I'm not able to find the proper documentation to follow, and I'm kind of lost. Is there is any resource that I can use for reference or any guidance from the experts, please?
To customize laravel aimeos to your needs, you can create a theme extension:
https://aimeos.org/docs/latest/laravel/themes/
Tool to generate a theme extension: https://aimeos.org/extensions
You will be able to make changes to the client views and components as well as to the administrative panel without losing the changes when updating the laravel aimeos package.
Regards,

How to use roles in a Laravel package

I'd like to have roles in a package I'm creating. What is the best way to do this?
Should I use an existing package (Entrust, Bouncer, etc.) or should I implement a roles feature with no dependency?
Using an existing package could end in a conflict if it's already installed in another version, or if another package is already used.
Implementing the feature with no dependency is like reinventing the wheel...
Actually, the best approch is probably to not define roles or implement authorization of any kind in the package and let the user define policies in their application.
Default policies may be provided and published with artisan vendor:publish command, if the user wants to.
Models should use Gate to check user's ability to view/create/delete/etc.

Can Laravel generate all mvc skeleton out of an existing table like that of cakephp's command cake bake all

I found laravel very interesting. But I'm wondering if there's any artisan command to generate all MVC skeleton files provided a database table all at ones. And how about separate generation of especially the model, given the table structure? or is there any alternative way to do the code generating?
You can create a migration file from the table via the package below.
https://github.com/Xethron/migrations-generator
Install it via : composer require --dev "xethron/migrations-generator"
Follow the package instructions, After connecting you application with the database simply run php artisan migrate:generate.
You will see number of migrations created via console message, You can also check your database/migrations folder for confirmation.
I didn't find how to do that, so I created my own code in order to create the models:
https://github.com/Triun/laravel-model-base
It is not super documented, but you can actually write your own addons in order to add custom business behaviors or include your own interfaces or traits to your models, with your own code.
And of course, reports and contributions are more than welcome.
I hope this helps.

Duplicate field issue in form view odoo

I have create one field in stock.quant.package model.
tracking_ref=fields.Char("Tracking Ref")
This field is used in two separate modules and I am not able to give module dependency because both are separate modules.
It may be possible that both modules are installed in same database or it may
be possible that in some database only one module is installed.
Due to that reason i have create same field & view in both modules.
But now issue is that if both modules are installed then field is
available two times in the form view.
Is there any possibility that if we install both modules then field will visible only one time in form view.
I am not sure it is the best solution. Just try:
Create a new Module, say module_common
Put all common fields and functions in new module module_common
Make this module dependent of another two modules.
Ex: module_a depends module_common and module_common depends module_common.
Hope it will resolve your problem.

how to use laravel illuminate in a custom project

I have a static site with a lot of pages. Now I got a new requirement. Client need a Client Area, I am thinking to use laravel Database Eloquent, Session, Form/html, Session and want to use them as alias like use in laravel/lumen. The problem is that I want static pages same as it is with .html extension, is there any solution? I want some packages with aliases to speed up.
I spent a complete day on Configuring Input and Eloquent but I wasn't able to setup to other packages. But I don't know how to set aliases and service providers. Any idea?
Specific:
I need Laravel Some packages
Session,
FileSystem
Mail
Input
Database
Html/Form,
Validation
I don't need others packages and need aliases same as laravel used in (config/app)
yes you can use laravel components outside laravel project please read the article : http://www.richardbagshaw.co.uk/using-illuminate-components/

Resources