title: Laravel: Passport API with accept image
body: <p>So I have already a working <code>api</code> using <code>laravel passport</code></p>
  
  <p>in my <code>controller</code> named as <code>AuthController.php</code></p>
  
  <p>I have this working code of saving data</p>
  
  <pre><code>    public function activity_log(Request $request){
  
      $validatedData = $request-&gt;validate([
          'projCode'=&gt;'required',
          'activity_desc'=&gt;'required',
          'type'=&gt;'required'
      ]);
  
      $tbl_projectlist = DB::connection('mysql')-&gt;select("SELECT * from tbl_projectlist WHERE proj_code = '".$request-&gt;projCode."'");
  
      if(empty($tbl_projectlist))
      {
          return response([
              "status"=&gt;"bad",
              "message"=&gt;"Invalid projCode doesn't exists."
          ]);
      }
      else if($request-&gt;type == "REPORT" || $request-&gt;type == "ISSUE")
      {
          $ActivityLog = new ActivityLog;
          $ActivityLog-&gt;projCode = $request-&gt;projCode;
          $ActivityLog-&gt;activity_desc = $request-&gt;activity_desc;
          $ActivityLog-&gt;type = $request-&gt;type;
          $ActivityLog-&gt;attachment = "/img/default-image.jpg";
          $ActivityLog-&gt;created_by_id = Auth::user()-&gt;company_id;
          $ActivityLog-&gt;created_by_name = Auth::user()-&gt;name;
          $ActivityLog-&gt;created_at = now();
          $ActivityLog-&gt;updated_at = now();
          $ActivityLog-&gt;save();
  
          return response([
              "status"=&gt;"ok",
              "message"=&gt;"Activity successfully submitted!"
          ]);
      }
      else
      {
          return response([
              "status"=&gt;"bad",
              "message"=&gt;"Invalid choose REPORT or ISSUE"
          ]);
      }
  
  }
  </code></pre>
  
  <p>and in my <code>api.php</code></p>
  
  <pre><code>Route::post('/login','Auth\Api\AuthController@login');
  
  Route::middleware('auth:api')-&gt;group(function () {
  
       Some routes...
  
       Route::post('/activity_log','Auth\Api\AuthController@activity_log');
  });
  </code></pre>
  
  <p>As of now i'm just storing the file path of the image <code>hard coded</code> which the img is located.</p>
  
  <p>What I'm trying to do is to accept img file and save to my folder and store the file path in my database</p>
  
  <p>I'm using postman to test my api with this</p>
  
  <p><a href="https://i.stack.imgur.com/rH8oA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rH8oA.png" alt="enter image description here"></a></p>
  
  <hr>
  
  <p><a href="https://i.stack.imgur.com/CTmBr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CTmBr.png" alt="enter image description here"></a></p>