Code Notes

All elapsed times should be stored in minutes. The Utils Facade class has multiple helper functions:

use Utils;

# Minutes to hours min
$hm = Utils::minutesToTimeParts(65);

# Returns:
[
    'h' => 1,
    'm' => 5,
]

echo Utils::minutesToTimeString(65);
# Outputs 1h 5m

If your add-on tracks any sort of times, the column should be a UNSIGNED BIG INT, or in the migrations:

Schema::create('aircraft', function (Blueprint $table) {
    $table->unsignedBigInteger('hours')->nullable()->default(0);
});

Helpers are functions that are accessible globally. While Laravel comes with a large number of helpers, and it's worth looking through the list, there are numerous helpers that have been added for phpVMS.

By default the built-in Laravel view() call will refer from the base path of the resources/views directory. Use the skin_view() helper to set the base path to the current skin, e.g: resources/views/layouts/{skin}

# This will look for the template file in resources/views/layouts/default/flights/index
echo skin_view('flights/index`);

There is a helper function called show_date() and show_datetime(), which will convert any dates and times into the user's local format, defaulting to UTC. All dates are stored in the database in UTC format. The standard dates/times are kept in two columns: created_at and updated_at.

echo show_datetime($user->created_at);

See Laravel Date Mutators

To read a setting from the settings table, use the setting() helper:

echo setting('general.start_date');

While the settings are referred to in a dotted format, they're stored with all underscores in the database. See [Settings]()