Skip to content

Commit afa81fb

Browse files
committed
first commit
0 parents  commit afa81fb

File tree

114 files changed

+185215
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+185215
-0
lines changed

.editorconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_size = 4
7+
indent_style = space
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false
13+
14+
[*.{yml,yaml}]
15+
indent_size = 2
16+
17+
[docker-compose.yml]
18+
indent_size = 4

.env.example

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
APP_NAME=Laravel
2+
APP_ENV=local
3+
APP_KEY=
4+
APP_DEBUG=true
5+
APP_URL=http://localhost
6+
7+
LOG_CHANNEL=stack
8+
LOG_DEPRECATIONS_CHANNEL=null
9+
LOG_LEVEL=debug
10+
11+
DB_CONNECTION=mysql
12+
DB_HOST=127.0.0.1
13+
DB_PORT=3306
14+
DB_DATABASE=laravel
15+
DB_USERNAME=root
16+
DB_PASSWORD=
17+
18+
# DB_CONNECTION=mysql
19+
# APP1_DB_HOST=app1ip
20+
# APP1_DB_PORT=app1port
21+
# APP1_DB_DATABASE=app1database
22+
# APP1_DB_USERNAME=app1username
23+
# APP1_DB_PASSWORD=app1password
24+
25+
# DB_CONNECTION=mysql
26+
# APP2_DB_HOST=app2ip
27+
# APP2_DB_PORT=app2port
28+
# APP2_DB_DATABASE=app2database
29+
# APP2_DB_USERNAME=app2username
30+
# APP2_DB_PASSWORD=app2password
31+
32+
BROADCAST_DRIVER=log
33+
CACHE_DRIVER=file
34+
FILESYSTEM_DISK=local
35+
QUEUE_CONNECTION=sync
36+
SESSION_DRIVER=file
37+
SESSION_LIFETIME=120
38+
39+
MEMCACHED_HOST=127.0.0.1
40+
41+
REDIS_HOST=127.0.0.1
42+
REDIS_PASSWORD=null
43+
REDIS_PORT=6379
44+
45+
MAIL_MAILER=smtp
46+
MAIL_HOST=mailpit
47+
MAIL_PORT=1025
48+
MAIL_USERNAME=null
49+
MAIL_PASSWORD=null
50+
MAIL_ENCRYPTION=null
51+
MAIL_FROM_ADDRESS="hello@example.com"
52+
MAIL_FROM_NAME="${APP_NAME}"
53+
54+
AWS_ACCESS_KEY_ID=
55+
AWS_SECRET_ACCESS_KEY=
56+
AWS_DEFAULT_REGION=us-east-1
57+
AWS_BUCKET=
58+
AWS_USE_PATH_STYLE_ENDPOINT=false
59+
60+
PUSHER_APP_ID=
61+
PUSHER_APP_KEY=
62+
PUSHER_APP_SECRET=
63+
PUSHER_HOST=
64+
PUSHER_PORT=443
65+
PUSHER_SCHEME=https
66+
PUSHER_APP_CLUSTER=mt1
67+
68+
VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
69+
VITE_PUSHER_HOST="${PUSHER_HOST}"
70+
VITE_PUSHER_PORT="${PUSHER_PORT}"
71+
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
72+
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

.gitattributes

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
* text=auto eol=lf
2+
3+
*.blade.php diff=html
4+
*.css diff=css
5+
*.html diff=html
6+
*.md diff=markdown
7+
*.php diff=php
8+
9+
/.github export-ignore
10+
CHANGELOG.md export-ignore
11+
.styleci.yml export-ignore

.gitignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/.phpunit.cache
2+
/node_modules
3+
/public/build
4+
/public/hot
5+
/public/storage
6+
/storage/*.key
7+
/vendor
8+
.env
9+
.env.backup
10+
.env.production
11+
.phpunit.result.cache
12+
Homestead.json
13+
Homestead.yaml
14+
auth.json
15+
npm-debug.log
16+
yarn-error.log
17+
/.fleet
18+
/.idea
19+
/.vscode
20+
text.txt

README.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Laravel
2+
3+
## Installation
4+
5+
* Create .env file through copy
6+
7+
```bash
8+
cp .env.example .env
9+
```
10+
11+
* Install project dependencies
12+
13+
```php
14+
composer install
15+
```
16+
17+
* Generate laravel key for application to run
18+
19+
```php
20+
php artisan key:generate
21+
```
22+
23+
* Install nodejs dependencies
24+
25+
```javascript
26+
npm install
27+
```
28+
29+
* Provide database credentials below in .env file.
30+
31+
```php
32+
DB_DATABASE=?
33+
DB_USERNAME=?
34+
DB_PASSWORD=?
35+
```
36+
37+
> Incase you want multidatabase connection then uncomment commented database and provide credentials
38+
39+
* To run the project
40+
41+
```php
42+
php artisan key:generate
43+
```
44+
45+
```php
46+
php artisan migrate --seed
47+
```
48+
49+
* Spin development servers
50+
51+
```javascript
52+
npm run dev
53+
```
54+
55+
```php
56+
php artisan serve
57+
```
58+
59+
* Then check localhost:8000 or click the link provided on npm run dev and check your browser
60+
61+
```php
62+
localhost:8000
63+
```

app/Console/Kernel.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
namespace App\Console;
4+
5+
use Illuminate\Console\Scheduling\Schedule;
6+
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
7+
8+
class Kernel extends ConsoleKernel
9+
{
10+
/**
11+
* Define the application's command schedule.
12+
*/
13+
protected function schedule(Schedule $schedule): void
14+
{
15+
// $schedule->command('inspire')->hourly();
16+
}
17+
18+
/**
19+
* Register the commands for the application.
20+
*/
21+
protected function commands(): void
22+
{
23+
$this->load(__DIR__.'/Commands');
24+
25+
require base_path('routes/console.php');
26+
}
27+
}

app/Events/CsvUploadData.php

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
namespace App\Events;
4+
5+
use Illuminate\Broadcasting\Channel;
6+
use Illuminate\Broadcasting\InteractsWithSockets;
7+
use Illuminate\Broadcasting\PresenceChannel;
8+
use Illuminate\Broadcasting\PrivateChannel;
9+
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
10+
use Illuminate\Foundation\Events\Dispatchable;
11+
use Illuminate\Queue\SerializesModels;
12+
13+
class CsvUploadData
14+
{
15+
use Dispatchable, InteractsWithSockets, SerializesModels;
16+
17+
public $name;
18+
/**
19+
* Create a new event instance.
20+
*/
21+
public function __construct($name)
22+
{
23+
$this->name = $name;
24+
}
25+
26+
/**
27+
* Get the channels the event should broadcast on.
28+
*
29+
* @return array<int, \Illuminate\Broadcasting\Channel>
30+
*/
31+
public function broadcastOn(): array
32+
{
33+
return [
34+
new PrivateChannel('channel-name'),
35+
];
36+
}
37+
}

app/Exceptions/Handler.php

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
3+
namespace App\Exceptions;
4+
5+
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
6+
use Throwable;
7+
8+
class Handler extends ExceptionHandler
9+
{
10+
/**
11+
* A list of exception types with their corresponding custom log levels.
12+
*
13+
* @var array<class-string<\Throwable>, \Psr\Log\LogLevel::*>
14+
*/
15+
protected $levels = [
16+
//
17+
];
18+
19+
/**
20+
* A list of the exception types that are not reported.
21+
*
22+
* @var array<int, class-string<\Throwable>>
23+
*/
24+
protected $dontReport = [
25+
//
26+
];
27+
28+
/**
29+
* A list of the inputs that are never flashed to the session on validation exceptions.
30+
*
31+
* @var array<int, string>
32+
*/
33+
protected $dontFlash = [
34+
'current_password',
35+
'password',
36+
'password_confirmation',
37+
];
38+
39+
/**
40+
* Register the exception handling callbacks for the application.
41+
*/
42+
public function register(): void
43+
{
44+
$this->reportable(function (Throwable $e) {
45+
//
46+
});
47+
}
48+
}
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\API;
4+
5+
use App\Http\Controllers\Controller;
6+
use App\Http\Requests\StoreLocationRequest;
7+
use App\Http\Requests\UpdateLocationRequest;
8+
use App\Http\Resources\LocationCollection;
9+
use App\Models\Location;
10+
use Illuminate\Http\Request;
11+
use Illuminate\Support\Facades\DB;
12+
13+
class LocationController extends Controller
14+
{
15+
/**
16+
* Display a listing of the resource.
17+
*/
18+
// public function index()
19+
// {
20+
// $location = Location::query()->orderBy('id', 'asc')->paginate(10);
21+
// return LocationCollection::collection($location);
22+
// }
23+
24+
// /**
25+
// * Store a newly created resource in storage.
26+
// */
27+
// public function store(StoreLocationRequest $request)
28+
// {
29+
// $data = $request->validated();
30+
// $location = Location::create($data);
31+
// return response()->json(new LocationCollection($location),201);
32+
// }
33+
34+
/**
35+
* Display the specified resource.
36+
*/
37+
public function show(string $postcode)
38+
{
39+
##'ID','Postcode', commented out
40+
$location = DB::table('locations')
41+
->select('Street_Address','Lat','Long')
42+
->where('Postcode', '=', $postcode)
43+
->whereNotNull('Postcode')
44+
->get();
45+
46+
if(sizeof($location) == 0){
47+
$response =['status' => 'Not Found! Check your postcode and try again', 'locations' => 'Not Found'];
48+
return response()->json($response,404);
49+
}
50+
else{
51+
$response =['status' => 'success', 'locations' => $location];
52+
return response()->json($response,200);
53+
}
54+
}
55+
56+
/**
57+
* Update the specified resource in storage.
58+
*/
59+
// public function update(UpdateLocationRequest $request, Location $location)
60+
// {
61+
// $data = $request->validated();
62+
// $location = Location::findOrFail($location);
63+
// $location->update($data);
64+
// return new LocationCollection($location);
65+
// }
66+
67+
// /**
68+
// * Remove the specified resource from storage.
69+
// */
70+
// public function destroy(Location $location)
71+
// {
72+
// $location = Location::findOrFail($location);
73+
// $location->delete($location);
74+
// return response()->json([""=>""],204);
75+
// }
76+
77+
}

0 commit comments

Comments
 (0)