This application was initially developed in the following tutorial series: How To Build a Links Landing Application in PHP with Laravel and Docker Compose.
A second series called A Practical Introduction to Laravel Eloquent ORM further develops this demo application to include new models and relationships.
The application uses GitHub releases to support a progressive learning strategy, with multiple versions based on each part of the series. Here’s an overview of all available releases:
- Tutorial 1: How To Create a One-to-Many Relationship in Laravel Eloquent
elo-tutorial1.0
- Tutorial 2: How To Insert New Database Records in Laravel Eloquent
elo-tutorial2.0
- Tutorial 3: How To Populate a Database with Sample Data using Laravel Seeders and Eloquent Models
elo-tutorial3.0
- Tutorial 4: How To Query the Database in Laravel with Eloquent Select
elo-tutorial4.0
- Tutorial 5: How to Refine Database Queries with Eloquent Where
elo-tutorial5.0
- Tutorial 6: How To Order Query Results in Laravel Eloquent
elo-tutorial6.0
- Tutorial 7: How To Get Total Result Count in Laravel Eloquent
elo-tutorial7.0
- Tutorial 8: How To Limit and Paginate Query Results in Laravel Eloquent
elo-tutorial8.0
- Tutorial 9: How To Update Database Records in Laravel Eloquent
elo-tutorial9.0
- Tutorial 10: How To Delete Database Records in Laravel Eloquent
elo-tutorial10.0
This application creates a links landing page where you can share relevant links to an audience.
Links are initially imported from a links.yml
file in the root of the application, and can be managed via Artisan commands (in the console / command-line).
Links are initially imported from a links.yml
file at the root of the repository. The seeds are only imported when the database is empty, so to not duplicate your links.
Link management is done via Artisan commands:
php artisan link:list
php artisan link:create
php artisan link:delete [LINK_ID]
If you want to try DigitalOcean's App Platform with this application, you may want to use the Deploy to DigitalOcean button at the top of this README. This will give you less customization options, but you can still manage your links via the console, on the App Platform dashboard.
The application includes a Docker Compose setup that you can use for development. Please follow the linked tutorial series for more information about how to set up Docker and Docker Compose.
It's recommended that you fork this repository to your own Github account. Then, clone your forked repository so that you can make changes to the application.
To bring the environment up:
docker-compose up -d
Running Composer:
docker-compose exec app composer install
Setting up App Key:
docker-compose exec app artisan key:generate
Running Migrations and Seeds:
docker-compose exec app artisan migrate --seed
Then you should be able to access the application on localhost:8080
.
Change the links.yml
file to change the links that get seeded into the database by default, when the application is deployed.
To manage links, use artisan
:
docker-compose exec app artisan link:list
This will list all links in the database. To add a new link, use link:create
, and link:delete LINK_ID
to delete links.
To deploy your customized version of this application to DigitalOcean's App Platform, you can use doctl
with the included App Spec file.
First, edit the .do/deploy.template.yml
file to change the github.repo
entries to your own forked repository URL. You may also want to change the name
of the application.
Then, run doctl:
doctl apps create --spec .do/deploy.template.yaml
Then go to your App Platform dashboard to follow the build logs.
You can find more details on how to use doctl
and the App Spec file in this post.