App Directory Location
From the Laravel documentation:
Laravel should always be served out of the root of the “web directory” configured for your web server. You should not attempt to serve a Laravel application out of a subdirectory of the “web directory”. Attempting to do so could expose sensitive files that exist within your application.
You want the public folder to be the web root of your public site, not the application root. Be sure to configure your web server to point to this location!
Get the dependencies
Once you have installed Composer and Node, and added both of them to your command path you can begin retrieving the dependencies for this application to run. Run the following command in a terminal within your project root to download PHP dependencies.
npm run production
This solution needs a simple SQL database in addition to your FileMaker database. If you don’t have a SQL server available, such as MySQL, you can use SQLite as an alternative. SQLite is a file-based database system and does not require setting up a database server.
SQL Database Configuration
This solution uses a SQL database for storing user logins and sessions. You can configure the connection to a SQL database to be used for this by setting the
db_xxxx= properties in the
.env file in the root of the application.
It’s best to use MySQL or another full hosted database if you have it available, but SQLite is fine for the limited use of managing user logins on a simple deployment, low-traffic site (less than ~100k hits per day). MySQL is a more performant, scalable, and reliable database solution than SQLite and significantly more robust, but for a simple portal deployment like this sample application which primarily will use FileMaker for data, SQLite will probably be fine if you don’t have a MySQL server available.
If you decide to use SQLite be aware that a database.sqlite file will be stored at
/database/database.sqlite in this application. This file is where the user logins are stored, and so you should back this file up regularly.
Set up your .env
The .env file is the configuration for a particular deployment. Copy the
.env.example file to
.env and modify the values in there to suit your configuration. You’ll need to enter information for your database, FileMaker connection, and Braintree/Stripe account information.
You’ll also need to generate a new app key, which is used for encryption. Run the following command to generate a new app key
php artisan key:generate
Perform database migrations
A new SQL database won’t have the tables and fields needed to run this app. Database migrations are already set up to create the tables and fields required for this app. These migrations will apply to the database you’ve configured in the
.env file. You can run these migrations by running the following command:
php artisan migrate
Map your FileMaker Fields
The default field mapping is for use with the Invoices starter solution. You’ll need to modify the preconfigured field mappings to work with your own solution. Change the key values in the
$fieldMapping array as well as the
$layout in each of the following Model files in the
/app/Models/ directory to point to your own fields and layouts.
$fieldMapping properties of the following Model files to match your FileMaker solution. Remember that each of the fields listed in these models files for mapping must be on the layouts you are specifying for them to be available through the Data API.
Customer Invoice LineItem
Adjust your portal configuration
You’ll need to adjust the features of the sample portal to match what you want to have enabled. The configuration options are documented and controlled through the
- Your company’s name and address
- Select Braintree or Stripe for payments (defaults to Braintree)
- Payment alert email delivery address
- Payment success FileMaker script name and layout
- Fields which should be searched against to match customers by email addresses
- Allow users to link logins to customers in your database by matching invoice numbers and amounts if their email isn’t already in your system
- Allow partial payments of invoices
- Show/hide tax fields on invoices
- Payments with PayPal through Braintree (your account must be configured for this)