Advertisement
Guest User

Untitled

a guest
Nov 20th, 2019
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.99 KB | None | 0 0
  1.  if($request->hasfile('photo'))
  2.     {
  3.        $attachments = [];
  4.  
  5.        foreach($request->file('photo') as $key => $attachment){
  6.            $data = $attachment->store($request->get('name'),'public');
  7.            array_push($attachments,$data);
  8.        }
  9.         }
  10.         if(count($attachments != null)){
  11.             $implodedAttachment = implode(', ',$attachments);
  12.         }
  13.  
  14.     $content->name = $request->input('name');
  15.     $content->description = $request->input('description');
  16.     $content->location = $request->input('location');
  17.     $content->district = $request->input('district');
  18.     $content->state = $request->input('state');
  19.     $content->phone_no = $request->input('phone_no');
  20.     $content->list = $request->input('list');
  21.     $content->type = $request->input('type');
  22.     $content->body = $request->input('body');
  23.     $content->service_offered = implode(",",$request->input('service_offered',[]));
  24.     $content->photo = $implodedAttachment;
  25.    
  26.     $content->update();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement