2016-07-13 3 views
1

등록 중에 프로필 이미지로 이미지를 업로드해야하는 등록 양식이 있습니다. 사용자가 나중에 업로드 할 수 있으므로 등록 양식에서이 업로드 필드를 제거하고 싶습니다. 그러나 문제는 등록입니다. 필드가 비어있을 수 없습니다 있도록 양식 이미지 프로세스에 연결되어,이 상점에 대한 코드가 등록 컨트롤러 내부의 제안입니다 :laravel의 등록 양식에서 이미지 입력란을 제거하십시오.

이 어떻게 디폴트 값을 제공 또는 이미지 처리에서 분리 할 수 ​​

public function store(RegisterUserRequest $request) 
{ 
    $newUserProfileImagePath = $profileImagePath = App::make('ProcessImage')->execute($request->file('profileimage'), 'images/profileimages/', 180, 180); 

    $newUserBirthday = Carbon::createFromDate($request->year, $request->month, $request->day); 

    $newUser = $this->dispatchFrom(RegisterUserCommand::class, $request, [ 
     'birthday' => $newUserBirthday, 
     'profileImagePath' => $newUserProfileImagePath 
    ]); 

    return redirect()->route('feeds_path'); 

} 
?

+0

결코 호출되지 않는 방식으로 이미지 처리와 연결된 코드 줄을 제거하십시오. –

+0

해당 이미지를 제거하면이 오류가 발생합니다. MarshalException MarshalException.php 17 행 : [프로필 이미지] 매개 변수를 다음으로 매핑 할 수 없습니다. 명령 [App \ Commands \ RegisterUserCommand] – Mehran

+0

또한 'profileImagePath'=> $ newUserProfileImagePath'을 제거 했습니까 –

답변

2

당신은 다음과 같은 값을 설정할 수 있습니다

$ newUserProfileImagePath = $하는 ProfileImagePath = "모든 이미지 경로";

또는이 방법과이 클래스 "RegisterUserCommand."에서 파일 업로드에 대한 모든 것을 제거하려고 할 수 있습니다.이 후에도 여전히 오류가 발생하면 "RegisterUserCommand"클래스를 업로드하십시오. 자세한 지침을 제공합니다. 해피

관련 문제