Skip to content

Commit bdd17a2

Browse files
committed
extract from PD3R Backend
1 parent 7fafd1d commit bdd17a2

File tree

181 files changed

+8025
-1
lines changed

Some content is hidden

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

181 files changed

+8025
-1
lines changed

.editorconfig

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

.env.example

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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+
9+
DB_CONNECTION=mysql
10+
DB_HOST=127.0.0.1
11+
DB_PORT=3306
12+
DB_DATABASE=homestead
13+
DB_USERNAME=homestead
14+
DB_PASSWORD=secret
15+
16+
BROADCAST_DRIVER=log
17+
CACHE_DRIVER=file
18+
SESSION_DRIVER=file
19+
SESSION_LIFETIME=120
20+
QUEUE_DRIVER=sync
21+
22+
REDIS_HOST=127.0.0.1
23+
REDIS_PASSWORD=null
24+
REDIS_PORT=6379
25+
26+
MAIL_DRIVER=smtp
27+
MAIL_HOST=smtp.mailtrap.io
28+
MAIL_PORT=2525
29+
MAIL_USERNAME=null
30+
MAIL_PASSWORD=null
31+
MAIL_ENCRYPTION=null
32+
33+
PUSHER_APP_ID=
34+
PUSHER_APP_KEY=
35+
PUSHER_APP_SECRET=
36+
PUSHER_APP_CLUSTER=mt1
37+
38+
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
39+
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

.gitattributes

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
* text=auto
2+
*.css linguist-vendored
3+
*.scss linguist-vendored
4+
*.js linguist-vendored
5+
CHANGELOG.md export-ignore

.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/node_modules
2+
/public/hot
3+
/public/storage
4+
/storage/*.key
5+
/vendor
6+
/.idea
7+
/.vscode
8+
/.vagrant
9+
Homestead.json
10+
Homestead.yaml
11+
npm-debug.log
12+
yarn-error.log
13+
.env
14+
.phpunit.result.cache

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
# PD3R-Repo-1
1+
# PD3R-LaravelBackend

app/Console/Kernel.php

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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+
* The Artisan commands provided by your application.
12+
*
13+
* @var array
14+
*/
15+
protected $commands = [
16+
//
17+
];
18+
19+
/**
20+
* Define the application's command schedule.
21+
*
22+
* @param \Illuminate\Console\Scheduling\Schedule $schedule
23+
* @return void
24+
*/
25+
protected function schedule(Schedule $schedule)
26+
{
27+
// $schedule->command('inspire')
28+
// ->hourly();
29+
}
30+
31+
/**
32+
* Register the commands for the application.
33+
*
34+
* @return void
35+
*/
36+
protected function commands()
37+
{
38+
$this->load(__DIR__.'/Commands');
39+
40+
require base_path('routes/console.php');
41+
}
42+
}

app/Exceptions/Handler.php

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?php
2+
3+
namespace App\Exceptions;
4+
5+
use Exception;
6+
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
7+
8+
class Handler extends ExceptionHandler
9+
{
10+
/**
11+
* A list of the exception types that are not reported.
12+
*
13+
* @var array
14+
*/
15+
protected $dontReport = [
16+
//
17+
];
18+
19+
/**
20+
* A list of the inputs that are never flashed for validation exceptions.
21+
*
22+
* @var array
23+
*/
24+
protected $dontFlash = [
25+
'password',
26+
'password_confirmation',
27+
];
28+
29+
/**
30+
* Report or log an exception.
31+
*
32+
* @param \Exception $exception
33+
* @return void
34+
*/
35+
public function report(Exception $exception)
36+
{
37+
parent::report($exception);
38+
}
39+
40+
/**
41+
* Render an exception into an HTTP response.
42+
*
43+
* @param \Illuminate\Http\Request $request
44+
* @param \Exception $exception
45+
* @return \Illuminate\Http\Response
46+
*/
47+
public function render($request, Exception $exception)
48+
{
49+
return parent::render($request, $exception);
50+
}
51+
}
Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
<?php
2+
3+
namespace App\Http\Controllers;
4+
5+
use App\UserDetail;
6+
use Illuminate\Http\Request;
7+
8+
class APIController extends Controller
9+
{
10+
public function store(Request $request){
11+
12+
$name = $request->name;
13+
$email = $request->email;
14+
$phone_no = $request->phone_no;
15+
$disaster_timeline = $request->disaster_timeline;
16+
$lat = $request->lat;
17+
$long = $request->long;
18+
$status = 'active';
19+
$housestatus = 'go';
20+
$external_face = $request->external_face;
21+
$masonry = $request->masonry;
22+
$damage_wall = $request->damage_wall;
23+
$storeys = $request->storeys;
24+
25+
26+
27+
if ($request->has('desc') && $request->desc != "") {
28+
29+
$desc = $request->desc;
30+
} else {
31+
$desc = '';
32+
}
33+
34+
if ($request->has('photo_1') && $request->photo_1 != "") {
35+
$path = $request->file('photo_1')->store('uploads/design', 'public');
36+
$photo_1 = $path;
37+
} else {
38+
$photo_1 = "";
39+
}
40+
41+
if ($request->has('photo_2') && $request->photo_2 != "") {
42+
$path = $request->file('photo_2')->store('uploads/design', 'public');
43+
$photo_2 = $path;
44+
} else {
45+
$photo_2 = "";
46+
}
47+
if ($request->has('photo_3') && $request->photo_3 != "") {
48+
$path = $request->file('photo_3')->store('uploads/design', 'public');
49+
$photo_3 = $path;
50+
} else {
51+
$photo_3 = "";
52+
}
53+
if ($request->has('photo_4') && $request->photo_4 != "") {
54+
$path = $request->file('photo_4')->store('uploads/design', 'public');
55+
$photo_4 = $path;
56+
} else {
57+
$photo_4 = "";
58+
}
59+
if ($request->has('photo_5') && $request->photo_5 != "") {
60+
$path = $request->file('photo_5')->store('uploads/design', 'public');
61+
$photo_5 = $path;
62+
} else {
63+
$photo_5 = "";
64+
}
65+
if ($request->has('photo_6') && $request->photo_6 != "") {
66+
$path = $request->file('photo_6')->store('uploads/design', 'public');
67+
$photo_6 = $path;
68+
} else {
69+
$photo_6 = "";
70+
}
71+
72+
if($masonry == 'no' || $external_face == 'no' || $damage_wall =='yes' || $storeys == 'yes' ){
73+
$details = new UserDetail();
74+
$details->name = $name;
75+
$details->email = $email;
76+
$details->phone_no = $phone_no;
77+
$details->disaster_timeline = $disaster_timeline;
78+
$details->lat = $lat;
79+
$details->long = $long;
80+
$details->desc = $desc;
81+
$details->status = $status;
82+
$details->photo_1 = $photo_1;
83+
$details->photo_2 = $photo_2;
84+
$details->photo_3 = $photo_3;
85+
$details->photo_4 = $photo_4;
86+
$details->photo_5 = $photo_5;
87+
$details->photo_6 = $photo_6;
88+
$details->masonry = $masonry;
89+
$details->external_face = $external_face;
90+
$details->damage_wall = $damage_wall;
91+
$details->storeys = $storeys;
92+
$details->house_status = 'nogo';
93+
94+
$details->save();
95+
$response = array(
96+
'status' => 'nogo',
97+
'msg' => 'New Details Request Send successfully',
98+
);
99+
return \Response::json($response);
100+
}else{
101+
$details = new UserDetail();
102+
103+
$details->name = $name;
104+
$details->email = $email;
105+
$details->phone_no = $phone_no;
106+
$details->disaster_timeline = $disaster_timeline;
107+
$details->lat = $lat;
108+
$details->long = $long;
109+
$details->desc = $desc;
110+
$details->status = $status;
111+
$details->photo_1 = $photo_1;
112+
$details->photo_2 = $photo_2;
113+
$details->photo_3 = $photo_3;
114+
$details->photo_4 = $photo_4;
115+
$details->photo_5 = $photo_5;
116+
$details->photo_6 = $photo_6;
117+
$details->masonry = $masonry;
118+
$details->external_face = $external_face;
119+
$details->damage_wall = $damage_wall;
120+
$details->storeys = $storeys;
121+
$details->house_status = $housestatus;
122+
123+
$details->save();
124+
125+
//call post API by sending the images
126+
$apiResponce = "post API url to AI model"
127+
128+
if($apiResponce == 0){
129+
$response = array(
130+
'status' => 'go',
131+
'msg' => 'New Details Request Send successfully',
132+
);
133+
return \Response::json($response);
134+
}else{
135+
$response = array(
136+
'status' => 'nogo',
137+
'msg' => 'New Details Request Send successfully',
138+
);
139+
return \Response::json($response);
140+
}
141+
}
142+
143+
144+
145+
}
146+
147+
public function test(){
148+
149+
150+
151+
$d = rand(0,1);
152+
153+
if($d == 0){
154+
$response = array(
155+
'status' => 'go',
156+
'msg' => 'New Details Request Send successfully',
157+
);
158+
return \Response::json($response);
159+
}else{
160+
$response = array(
161+
'status' => 'nogo',
162+
'msg' => 'New Details Request Send successfully',
163+
);
164+
return \Response::json($response);
165+
}
166+
167+
168+
}
169+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Auth;
4+
5+
use App\Http\Controllers\Controller;
6+
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
7+
8+
class ForgotPasswordController extends Controller
9+
{
10+
/*
11+
|--------------------------------------------------------------------------
12+
| Password Reset Controller
13+
|--------------------------------------------------------------------------
14+
|
15+
| This controller is responsible for handling password reset emails and
16+
| includes a trait which assists in sending these notifications from
17+
| your application to your users. Feel free to explore this trait.
18+
|
19+
*/
20+
21+
use SendsPasswordResetEmails;
22+
23+
/**
24+
* Create a new controller instance.
25+
*
26+
* @return void
27+
*/
28+
public function __construct()
29+
{
30+
$this->middleware('guest');
31+
}
32+
}

0 commit comments

Comments
 (0)