/calendar

Laravel 8 side project to experiment with Livewire 2 calendar options

Primary LanguagePHP

Calendar

This is a project to look at calendars using Laravel Livewire, two are being investigated:

This is a Laravel 8 side project to experiment with Livewire 2 calendar options.

Requirements

This is a Laravel 8 project with Livewire 2 and Tailwind installed. The installation is similar to a new Laravel project.

Recommended:

Clone

See Cloning a repository for details on how to create a local copy of this project on your computer.

e.g.

git clone git@github.com:Pen-y-Fan/calendar.git

Install the Dependencies

Install all the dependencies using composer

cd calendar
composer install
npm install
npm run dev
npm run watch

Create an .env file

Create an .env file from .env.example

composer post-root-package-install

Generate an APP_KEY

php artisan key:generate

Update the Database Settings

The Calendar demo uses an Event table, which can be seeded with Lorem Ipsum data from a MySQL database or Sqlite database.

MySql

For MySql, create a database on your MySql server and add the settings to the .env file:

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=YourDatabaseName
DB_USERNAME=YourDatabaseUserName
DB_PASSWORD=YourDatabaseUserPassword

Sqlite

Alternatively create an empty sqlite database and configure Laravel to use Sqlite

Sqlite on Linux / Mac
touch database/database.sqlite
Sqlite on Windows
fsutil file createnew database/database.sqlite 0

Sqlite .env file

Edit the .env file, add sqlite as the DB_CONNECTION and delete all the other DB_* keys.

DB_CONNECTION=sqlite
DB_HOST=127.0.0.1   }
DB_PORT=3306        }
DB_DATABASE=laravel } Delete
DB_USERNAME=root    }
DB_PASSWORD=        }

Create the database

Run the following command to create the database, you choose in your .env file and seed the tables with Lorem Ipsum data:

php artisan migrate --seed

Sqlite in Memory Testing Database

The phpunit.xml file has been configured for Sqlite in memory testing. This requires the pdo_sqlite extension to be enabled in your php.ini. If there are any problems enabling the extension remove the following lines, PHPUnit will then to use the database configured in your .env file.

<server name="DB_CONNECTION" value="sqlite"/>
<server name="DB_DATABASE" value=":memory:"/>

Run all tests

To make it easy to run all the PHPUnit tests a composer script has been created in composer.json. From the root of the projects, use composer tests

composer tests

Dusk tests

To run the Dusk tests:

php artisan dusk

Serve website

To use the php web server, run the following artisan command:

php artisan serve

Open the website

See the message under the serve command for the website name and port, by default it is:

The Calendar welcome page will display, navigate to:

Note: The events in the calendar share the same seed data, however the livewire calendar uses the date field and the full calendar uses the start field, so any updates to the date in one will not affect the other, the title is common to both.

Contributing

This is a personal project. Contributions are not required. Anyone interested in developing this project are welcome to fork or clone for your own use.

Credits

License

MIT License (MIT). Please see License File for more information.