This is a website, called Cunection (pronounced just like "connection"), built originally as a Senior Project in the fall of 2022. It is intended to continue on, hopefully into production.
Cunection is a website for clubs, specifically on the CUNE Campus in Seward, NE. Of course, it is not limited to only that campus. It was built to connect students with clubs and club events, along with giving club admins a platform to reach out to students. We want to increase both club participation and club outreach on campus.
We hope to pass this project on to the Programming Team at CUNE for further development in the future.
The API uses the ORM (object-relational mapping) included with Laravel called Eloquent, which allows you to interact with each database table using its corresponding model. Eloquent also allows you to define relationships between models, such as One-to-One and One-to-Many relationships. Many-to-Many relationships require a third table, known as a ‘pivot’ table. Eloquent will automatically handle interactions with this table for you when you define a Many-to-Many relationship. The models we are currently using are User and Club. User and Club have a Many-to-Many relationship because a user can follow many clubs, and a club can have many users that follow it.
We define the API endpoints using three controllers: UserController, ClubController, and FollowerController. The UserController handles user registration and login/logout. The ClubController currently handles retrieving club info. In the future, this is where you could handle things like editing club info. The FollowerController currently handles retrieving the clubs that are followed by a given user. In the future, this is where you could handle retrieving the users that follow a given club. We assign these endpoints to API routes in the routes/api.php file
We are currently using an SQLite database for this project. The users, password_resets, failed_jobs, and personal_access_tokens tables were created as part of the tutorial we followed. The clubs table stores clubs and their info, while the club_user table acts as the pivot table for the Many-to-Many relationship between clubs and users. The club_user table also stores a boolean for each club that a user follows that can be used to determine if the user wishes to receive notifications from that club.
Each table in the database is created using a migration, which the Laravel documentation describes as “version control for your database.” Migrations allow you to modify and share the schema of your database. If you wanted to modify a database table on a shared project, you simply need to modify the table’s migration and then anyone working on the project can run the migration locally and will be able to use the modified schema.
Integration tests using PEST for each of the controllers can be found in the tests/Feature/Http/Controllers/API folder. End-to-end browser tests using Laravel Dusk can be found in the tests/Browser/ folder.
This project was developed using npm and Laravel.
After downloading the project, running npm install
should download all of the necessary dependencies.
You will need to create a .env file at the root of the project and copy the contents of .env.example into it. You will also need to create a .env.dusk.local at the root of the project and copy the contents of .env.dusk.local.example into it in order to run the Laravel Dusk tests later.
Before you run the project for the first time you will need to run the database migrations. Run php artisan migrate
and then type yes
when prompted to create a new database file. You can now seed the database by running php artisan db:seed
.
To compile and hot-reload for development, use npm run dev
.
To compile and minify for production, use npm run build
.
To start the Laravel project, run php artisan serve
.
To run the PEST tests, run ./vendor/bin/pest
.
To run the Laravel Dusk (browser) tests, you first need to start the project using
php artisan serve --env=dusk.local
You can then run the Dusk tests using php artisan dusk
.
---0
Faith Brown and Neal Patron are the heads of this project, as it was their senior project.
The main tutorial we followed to incorporate Laravel Sanctum with Vue 3 for authentication was from Shouts.dev.