vaibhavpandeyvpz/laravel-crud

This package is abandoned and no longer maintained. The author suggests using the vaibhavpandeyvpz/starter-laravel package instead.

The skeleton application for the Laravel framework.


README

Quick, Laravel CRUD boilerplate using Livewire with RBAC. Uses Docker for local development & production deployments, has better auth views based on Bootstrap, nicely integrates Select2 and Flatpickr as well.

Prepare

If you wish to use SSL for local development (recommended), you need to have mkcert installed on your machine. Once installed, next install the mkcert's local CA in system's trust store.

$ sudo mkcert -install

Then generate an SSL certificate for local development using below command:

$ mkcert local.dev '*.local.dev' localhost 127.0.0.1 ::1

Installation

Before installing, make sure to have Docker installed on your workstation. Then simply download or clone the code and run below commands in project folder:

# start the services
$ docker-compose up -d

# spawn a shell in web container
$ docker-compose exec web bash

# install dependencies
$ composer install && yarn install && yarn build

# create sample .env file
$ php -r "file_exists('.env') || copy('.env.example', '.env');"

# setup NGROK_AUTHTOKEN in .env

# set application key
$ php artisan key:generate

# initialize scout indices
$ php artisan scout:sync-index-settings

# prepare database
$ php artisan migrate --seed

# link public storage directory
$ php artisan storage:link

You can access the project via browser at https://web.local.dev/ or http://localhost:8000/.

To be able to manage users, roles etc., you must create or assign relevant roles to a user. You can do so by running below command and providing the user information interactively:

$ php artisan make:admin

Extras

Traefik requires you to route hostnames to your local machine. To do so, add the following lines to your /etc/hosts file:

127.0.0.1 cdn.local.dev
127.0.0.1 mailcatcher.local.dev
127.0.0.1 meilisearch.local.dev
127.0.0.1 minio.local.dev
127.0.0.1 phpmyadmin.local.dev
127.0.0.1 redis-commander.local.dev
127.0.0.1 web.local.dev

The Docker setup also include below services to ease local development:

Some additional configuration described below may be needed for extended functionality.

File uploads

Before uploading files, you may need to log in to MinIO console at https://minio.local.dev/ using laraveldev as both (username and password) and create a bucket named laraveldev. Once created, go to bucket's settings and change its Access Policy to Public.

Ngrok

The project setup also includes ngrok service. To get the active tunnel URL, use below command:

# start the services
$ docker-compose up -d

# show ngrok tunnel url
$ php artisan ngrok:discover

Code-style

The project uses laravel/pint to enforce code-style. To run it and fix any issues, use below command:

$ docker run --rm -v .:/workspace syncloudsoftech/pinter

Deployment

You can deploy the project into production (using Docker) using below commands:

# build production container
$ docker build -t laraveldev .

# push image to registry
$ docker push laraveldev