2017-05-11 3 views
1

Laravel 5.4에 문의 양식을 작성하려고합니다. 나는 거의 성공했지만 실제 메일 외에도 내 메일에 페이지의 구조가 나타납니다 (스크린 샷보기). 그걸 도와 줄 수있어? enter image description here문의 양식 Laravel 5.4

내보기 형태 :

   <div class="row"> 

     {{ Form:: open(array('action' => '[email protected]')) }} 

     <ul class="errors"> 
     @foreach($errors->all('<li>:message</li>') as $message) 
     {{ $message }} 
     @endforeach 
     </ul> 

     <div class="form-group"> 
     {{ Form:: textarea ('message', '', array('placeholder' => 'Message', 'class' => 'form-control', 'id' => 'message', 'rows' => '7')) }} 
     </div> 




     <div class="modal-footer"> 
     {{ Form::submit('Submit', array('class' => 'btn btn-primary')) }} 
     {{ Form:: close() }} 


     </div> 
      </div> 

그리고 내 컨트롤러 :

<div class="modal-footer"> 
    {{ Form::submit('Submit', array('class' => 'btn btn-primary')) }} 
    {{ Form:: close() }} 
</div> 

이 사람 :이

namespace App\Http\Controllers; 
use Input; 
use Illuminate\Http\Request; 
use Validator; 
use Mail; 
use Redirect; 

class ContactController extends Controller 
{ 
public function getContactUsForm(Request $request){ 
    //Get all the data and store it inside Store Varible 
    $data = \Input::all(); 
    //$data = $request->message; 
    //$data = $request->input('message'); 

    //Validation rules 
    $rules = array (
     //'first_name' => 'required', uncomment if you want to grab this field 
     //'email' => 'required|email', uncomment if you want to grab this field 
     'message' => 'required|min:5' 
    ); 

    //Validate data 
    $validator = Validator::make ($data, $rules); 

    //If everything is correct than run passes. 
    if ($validator -> passes()){ 



    Mail::send('support/contact', $data, function($message) use ($data) 
      { 
       //$message->from($data['email'] , $data['first_name']); uncomment if using first name and email fields 
       $message->from('[email protected]', 'contact form'); 
    //email 'To' field: cahnge this to emails that you want to be notified. 
    $message->to('[email protected]', 'Masha')->subject('Contact Form'); 

      }); 
      // Redirect to page 
    return Redirect::route('contact') 
    ->with('message', 'Your message has been sent. Thank You!'); 


      //return View::make('contact'); 
     }else{ 
    //return contact form with errors 
      return Redirect::route('contact') 
      ->with('error', 'Feedback must contain more than 5 characters. Try Again.'); 

    } 
} 
} 
+0

아무 것도 튀어 나오지 않습니다. getContactUsForm 함수 바로 다음에 dd ($ request)를 수행하고 전체 페이지 또는 정보 만 전달되었는지 확인하십시오. 그것의 견해를 움켜 잡고 당신에게 그것을 보내는 것은 이상합니다. 해당 페이지에 다른 양식이있어 방해가 될 수 있습니까? – Scott

+0

"해당 페이지에 다른 양식이있어 방해가 될 수 있습니까?" 아니요, 웹 사이트에는 단 하나의 양식입니다. – Rost

+0

페이지를 마우스 오른쪽 버튼으로 클릭하고 소스를보고 'css'링크 중 하나를 클릭하여 파일 내용에 도달했는지 확인하십시오. 그렇지 않다면 링크가 깨 졌음을 알 수 있습니다. 각'css link'를 통해 작업하십시오 –

답변

0

변화

<div class="modal-footer"> 
    {{ Form::submit('Submit', array('class' => 'btn btn-primary')) }} 
</div> 
{{ Form:: close() }} 

주문 구조가 고장 났다고 생각합니다.

+1

답변 주셔서 감사합니다 .. 실제로는 좋은 생각이지만 도움이되지 않았습니다. ... $ data = \ Input :: all(); $ data = $ request-> input ('message')와 같은 일을하십시오; – Rost

+0

거의 주문 문제입니다. 전체 파일을 ** Pastebin.com ** 또는 유사한 파일로 복사 할 수 있다면 더 많은 것을 도와 드릴 수 있습니다. – MohamedSabil83

+0

도 ** ** 사이에 CSS 파일을 연결하십시오. – MohamedSabil83