Created
March 10, 2017 21:40
-
-
Save segun6060/305d4c067f970c5747e0af4dda739af1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function caller(Request $request) | |
{ | |
$this->validate($request,[ | |
'avatar' => 'required|image|max:10240', | |
'reciever_id' => 'required', | |
]); | |
$image = new Imagene; | |
//change model name Image to something else because u are using Image as alias if u not then it will give u a errors | |
$image->user_id = Auth::user()->id; | |
$image->reciever_id = $request->reciever_id; | |
if ($request->hasFile('avatar')) | |
{ | |
$avatar = $request->file('avatar'); | |
$filename = time().'.'.$avatar->getClientOriginalExtension(); | |
$location = public_path('images/'.$filename); | |
Image::make($avatar)->resize(300,300)->save($location); | |
$image->name=$filename; | |
$image->save(); | |
} | |
Session::flash('success','The proof has been recieved you will be comfirm soon!'); | |
return back(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form action="/caller" method="POST" class="form-inline" enctype="multipart/form-data"> | |
<a href="#"> | |
{{ csrf_field() }} | |
<div class="form-group hideform" style="display:none;"> | |
<input name="reciever_id" value="{{ $message->reciever_id}}" class="form-control" type="text" required="" /> | |
</div> | |
<div class="form-group"> | |
<input name="avatar" class="form-control" type="file" required="" /> | |
</div> | |
<div class="form-group"> | |
<input type="submit" class="btn btn-primary pull-right" value="submit"> | |
</div> | |
</form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment