Giter VIP home page Giter VIP logo

notice-board's Introduction

Notice board

Installation

First clone this repository, install the dependencies, and setup your .env file.

git clone https://github.com/junaidbinfarooq/notice-board.git
cd notice-board
composer install
cp .env.example .env

Database and migrations

Now create the necessary database. The following was tested on MySQL.

create database notice_board;

And run the initial migrations and seeders.

php artisan migrate --seed

Application key.

Generate an API key for the application.

php artisan key:generate

Mailer config.

Enter mailer configuration in the .env file. This is used to send emails to an admin when a new story is published. Mailtrap was used during the development. Please choose your own mailer. Following config options are mandatory:

  • MAIL_MAILER: mail|sendmail|smtp
  • MAIL_HOST: eg., mailtrap.io|smtp.gmail.com
  • MAIL_PORT: eg., 2525|587
  • MAIL_USERNAME: Your username
  • MAIL_PASSWORD: Your password
  • MAIL_FROM_ADDRESS: Your email address that will be used as the sender address

Running the server.

Finally , run the server.

php artisan serve

Queued jobs.

The emails are initially queued and then picked up by a queue worker. To run the queue worker, run the following command.

php artisan queue:work

Server-sent events.

When a new story is published and subsequently approved by an admin, an event is broadcasted to all the users informing them about the event. The app uses pusher for this purpose while you could use any other broadcasting library. Please update the following environment variables in the .env file to make use of pusher:

  • BROADCAST_DRIVER: Set this to pusher
  • PUSHER_APP_ID: Your pusher app id
  • PUSHER_APP_KEY: Your pusher app key
  • PUSHER_APP_SECRET: Your pusher app secret
  • PUSHER_APP_CLUSTER: Your pusher app cluster

You would also need to install the pusher library.

composer require pusher/pusher-php-server

On the front-end, you can either use inline scripts or use laravel echo and pusher libraries to listen to server-sent events. Run the following commands to install those libraries and then head to the laravel documentation to learn how to use them.

npm install --save-dev laravel-echo pusher-js

More information about the pusher library can be found here.

Moreover, the queue works needs to be up and running to process the events as they are queued.

Login.

The seeder adds a default admin user. You can login using the following credentials.

Password: password

notice-board's People

Contributors

junaidbinfarooq avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.