davy_yg
2 weeks ago

validation

Posted 2 weeks ago by davy_yg

I wonder why eventhough I uploaded an word doc or extra large email. The validation error message does not appears?

ProfileController.php

public function update(Request $request, $id)
	{
    $this->validate($request,[
        'nim' => 'required|digits:8',
        'nama' => 'required',
        'alamat' => 'required'
    ]);

    $profile = Profile::find($id);

    $file = $request->file('photo');

    if($file){

        $this->validate($request,[
            'foto' => 'required|image|dimensions:max_width=250, max_height=250'
        ]);
        // storage/app/public/photo/random.jpg
        $path = $request->file('photo')->store('public/photo');
        $profile->photo = $path;
    }

    $profile->nim = $request->nim;
    $profile->nama = $request->nama;
    $profile->alamat = $request->alamat;

    $profile->update();

    Session::flash('flash', 'Successfully update data');

    return redirect()->back();
	}

Please sign in or create an account to participate in this conversation.