Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. namespace AppHttpControllers;
  2.  
  3. use IlluminateHttpRequest;
  4. use AppService;
  5. class ServiceController extends Controller {
  6.  
  7. public function __construct()
  8. {
  9. $this->middleware('auth');
  10. }
  11.  
  12.  
  13. public function store(Request $request)
  14.  
  15. {
  16.  
  17. $this->validate($request, [
  18.  
  19.  
  20. 'image' => 'required|image|mimes:jpeg,png,jpg|max:2048',
  21. ]);
  22.  
  23.  
  24. $input['image'] = time().'.'.$request->image->getClientOriginalExtension();
  25. $request->image->move(public_path('Folder-A/'), $input['image']);
  26. Service::create($input);
  27.  
  28.  
  29. return back()
  30.  
  31. ->with('success',' CREATED SUCCESSFULLY .');
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement