Built on the Laravel framework 5.1 for Long Term Support (LTS).
- Clone the git-repository into a directory of your choice - preferable in your Homestead virtual machine.
- In the project directory, run
composer create-project
to create a default.env
file. - Set up the site and database to be served by a webserver - preferable in your Homestead.yaml file.
- Put database credentials in
.env
and runphp artisan migrate
in the project directory to create the tables.
Configure PhpStorm if relevant.
We're using Laravel's Elixir for assets, so run npm install
and bower install
in the project root and then gulp
or gulp watch
will build the assets during development.
In a deployment, run gulp --production
instead (after installing composer dependencies).
The base PHP namespace is Matchappen
.
Controllers are found in app/Http/Controllers and the routes to them in app/Http/routes.php. Route-Model binding is configured in app/Providers/RouteServiceProvider.php.
Models are placed directly in the [app] directory.
Workplace represents companies/organisations that students can get in contact with.
Opportunity represents meetings offered by a Workplace
.
Booking represents a booking on an Opportunity
.
Each Booking
has a number of visitors
which is 1 if made by a student, and may be >1 if made by a supervisor.
If a Booking
has reserved_until
time set, it should be soft-deleted after that time passes.
Occupation represents occupations that are related to Workplace
and Opportunity
.
User represents Workplace
users as well as system wide admins (identified by is_admin
).
Admin users can be created directly in the database table users
,
or through php artisan tinker
with
$admin = Matchappen\User::create(['email'=>'[email protected]', 'name' => 'admin', 'is_admin' => 1]);
$admin->is_admin = 1;
$admin->save();
After the admin user record is saved, the user can set their desired password
by entering their email address through the password reset url, if outgoing email is configured.
If not, you can set and save the password
attribute on the model using bcrypt()
:
$admin->password = bcrypt('PW GOES HERE');
$admin->save();
Workplace users and system admins are standard Laravel users,
each an instance of the User
model.
These users log in and out using the standard Laravel AuthController
and reset their passwords through the PasswordController
Students as well as their supervisors (teachers, vocational guidance counselors SYV, and other school personnel) log in when necessary using their email address and and an AccessToken instance. The Matchappen\Services\EmailTokenGuard keeps track of the current login status and privileges for these token-users.
Authorization policies for models are defined in app/Policies, registered in (app/Providers/AuthServiceProvider.php)[app/Providers/AuthServiceProvider.php] and can be checked throughout controllers, blade-views, etc using the standard Laravel ways.
The site accepts student and supervisor email patterns that are defined in config/school.php.
The validation messages related to those email patterns can be edited in
validation.php
under custom.student_email.regexp
, custom.supervisor_email.regexp
, and custom.edu_email.regexp
.
Tests for the email patterns should be updated and run through
vendor/bin/phpunit
after any modifications to the patterns.
Outgoing email is configured in .env
, see .env.example.
Set MAIL_DRIVER=log
to log emails instead of sending them from your development environment.
Depending on the email server configuration, make sure to catch bounced or rejected outgoing emails. Any outgoing email that didn't reach its intended receiver should raise the EmailWasRejected event. This can be done from within the app or from the outside through the 'php artisan bookings:handle-email-rejection' command.
Install and set up a queue driver like Redis, and run it to make mail sending asynchronous.
Remember to set the QUEUE_DRIVER
in .env
.
Remember to configure the Laravel scheduler on the server to periodically run the jobs that are scheduled in app/Console/Kernel.php.
Matchappen was conceived within 11:11 Meet Malmö and originally designed and built by FEW for Malmö Stad.
The Laravel framework is open-sourced software licensed under the MIT license
Matchappen's code is released as open source in accordance with the Malmö Stad Web Application Guidelines.