diff --git a/config/app.php b/config/app.php index a1b2bc5..cfcca72 100644 --- a/config/app.php +++ b/config/app.php @@ -12,7 +12,7 @@ return [ | any other location as required by the application or its packages. */ - 'name' => env('APP_NAME', 'October CMS'), + 'name' => env('APP_NAME', 'Menzil Mekan'), /* |-------------------------------------------------------------------------- diff --git a/config/backend.php b/config/backend.php index 99b4441..3a2b72a 100644 --- a/config/backend.php +++ b/config/backend.php @@ -44,7 +44,7 @@ return [ 'brand' => [ 'enabled' => false, - 'app_name' => env('APP_NAME', 'October CMS'), + 'app_name' => env('APP_NAME', 'Menzil Mekan'), 'tagline' => 'Administration Panel', 'menu_mode' => 'icons', 'color_mode' => 'light', diff --git a/config/mail.php b/config/mail.php index 19defe9..8c2e629 100644 --- a/config/mail.php +++ b/config/mail.php @@ -93,7 +93,7 @@ return [ 'from' => [ 'address' => env('MAIL_FROM_ADDRESS', 'noreply@example.tld'), - 'name' => env('MAIL_FROM_NAME', 'October CMS'), + 'name' => env('MAIL_FROM_NAME', 'Menzil Mekan'), ], ]; diff --git a/plugins/ahmadfatoni/apigenerator/controllers/api/ContactController.php b/plugins/ahmadfatoni/apigenerator/controllers/api/ContactController.php index 3144cf7..88833a6 100644 --- a/plugins/ahmadfatoni/apigenerator/controllers/api/ContactController.php +++ b/plugins/ahmadfatoni/apigenerator/controllers/api/ContactController.php @@ -41,24 +41,48 @@ class ContactController extends Controller public function store(Request $request){ - $arr = $request->all(); + $arr = $request->all(); unset($arr['/api/v1/contact']); - - while ( $data = current($arr)) { + + while ($data = current($arr)) { $this->Contacts->{key($arr)} = $data; next($arr); } - + $validation = Validator::make($request->all(), $this->Contacts->rules); - if( $validation->passes() ){ + if($validation->passes()){ $this->Contacts->save(); + + $vars = [ + 'name' => $request->input('name'), + 'email' => $request->input('email'), + 'messsage' => $request->input('message'), + 'phone' => $request->input('phone'), + ]; + + \Mail::send('ahmadfatoni.apigenerator::mail.contactForm', $vars, function($message) use ($request) { + + $message->to('gerchekgerchek1@gmail.com', 'Admin Person'); + $message->subject('Menzil Mekan'); + + if($request->hasFile('file')){ + $file = $request->file('file'); + $message->attach($file->getRealPath(), [ + 'as' => $file->getClientOriginalName(), + 'mime' => $file->getClientMimeType(), + ]); + } + }); + return $this->helpers->apiArrayResponseBuilder(201, 'created', ['id' => $this->Contacts->id]); - }else{ - return $this->helpers->apiArrayResponseBuilder(400, 'fail', $validation->errors() ); + } else { + return $this->helpers->apiArrayResponseBuilder(400, 'fail', $validation->errors()); } - } + + + public function update($id, Request $request){ diff --git a/plugins/ahmadfatoni/apigenerator/views/mail/contactForm.htm b/plugins/ahmadfatoni/apigenerator/views/mail/contactForm.htm new file mode 100644 index 0000000..35694f5 --- /dev/null +++ b/plugins/ahmadfatoni/apigenerator/views/mail/contactForm.htm @@ -0,0 +1,4 @@ +Имя : {{name}}
+Электронная почта : {{email}}
+Сообщение : {{messsage}}
+Телефон : {{phone}}
\ No newline at end of file