Skip to content
This repository was archived by the owner on Apr 28, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

119 changes: 119 additions & 0 deletions .idea/coding-test.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

118 changes: 118 additions & 0 deletions .idea/php.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions .idea/phpunit.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 15 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
# Laravel Coding Test

You should have been told which set of tasks to complete. If not please let your contact know.

Feel free to do both sets if you want.

## Backend

1. Add a page for users to register
2. Use http://postcodes.io/ to ensure that users submit a valid postcode
3. Send a welcome email when a user is registered
4. Add an artisan command to list recently registered users

## Frontend

Start the development server using `php artisan serve` and go to http://127.0.0.1:8000/address

1. Make the address lookup component accessible
2. Style it using bootstrap
# Steps to run project locally

1. Clone project
2. Go to the folder application using cd command on your cmd or terminal
3. Run composer install on your cmd or termial
4. Copy .env.example file to .env on the root folder. You can type copy .env.example .env if using command prompt Windows or cp .env.example .env if using terminal, Ubuntu
5. Open your .env file and change the database name (DB_DATABASE) to whatever you have, username (DB_USERNAME) and password (DB_PASSWORD) field correspond to your configuration.
6. Run php artisan key:generate
7. Run php artisan migrate
8. Run php artisan serve
9. Go to localhost:8000/register
10. Enter your data and check the entered email to preview the mail notification
11. Check your database to preview registration functionality
12. Try different data with wrong postal code to review postcode api
13. In your command line try php artisan list-recently-registered-users
46 changes: 46 additions & 0 deletions app/Console/Commands/listRegisteredUsers.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

namespace App\Console\Commands;

use App\User;
use Illuminate\Console\Command;

class listRegisteredUsers extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'list-recently-registered-users';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Command to list all recently registered users';

/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}

/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
User::whereBetween('created_at', [now()->subMinutes(1440), now()]) ->get()->each(function ($user) {
echo "\033[32m UserName: \e[0m $user->name \033[32m Email: \e[0m $user->email \033[32m Registered: \e[0m $user->created_at \n";

});
}
}
Loading