Create new module

Hello everyone!
What do I need to do to add a new module? I added a new directory in ‘application\modules’. I added a new table. I added an entry in navbar.php.

What else do I need to do?

Hey,
I’ll answer on Slack and then i’ll paste the answer here

Ok, let’s see, new module…
First: the module side-bar. Go to settings, there’s a setting that will let you show the module side-bar. Can you add your module there as well?

Let’s say your new module is ‘expenses’. If you go to https://your-site.com/expenses you should see the index of your module.
There must be a way to add an expense, is that button working?
Then you should see in your url https://your-site.com/expenses/form (or /create).

Does your module have settings?
Does your module have database tables?

Does your module have settings?

no

Does your module have database tables?

Yes

On application/modules I create directory ‘expenses’.

On navbap.php i add

<li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                        <i class="fa fa-caret-down"></i> &nbsp;
                        <span class="hidden-md"><?php _trans('expenses'); ?></span>
                        <i class="visible-md-inline fa fa-users"></i>
                    </a>
                    <ul class="dropdown-menu">
                        <li><?php echo anchor('expenses/form', trans('add_expenses')); ?></li>
                        <li><?php echo anchor('expenses/index', trans('view_expenses')); ?></li>
                    </ul>
                </li> 

but I sill have 404 Not found
:frowning:

Expenses, i knew it :slight_smile:

Ok, get your code tk github and i’ll take a look next week.
If you don’t want to show your code to the world, make it a private repository.

Are you sure it’s not something like /index.php/expenses instead of /expenses?

Version 2 of InvoicePlane already has an expenses module, so that’s going to be tricky going from V1 to V2 of InvoicePlane.

Expenses are just an example. The module is Projects for Quotes.

I am learning to create a new module.

Kopied the customer module, changed the folder name, and linked it to the menu to check if it works.

Not working

I’m wondering how to create a new module similar to Customers. The Expenses module will also be needed, but later.

**.pl/index.php/quotes_projects/index
404 Page Not Found
The page you requested was not found.

1 Like

Ok, just let me know once the source is somewhere where i can see it, clone it, etc.

quotes_projects is an interesting name. Is that thr same name in your /application/modules directory? And how about the controller name?

I would rename your special new module to something very simple, 1 single word.

Then try again.