title: Get user current location in laravel
body: <pre><code>&lt;?php
  
  namespace App;
  
  use App\Traits\MultiTenantModelTrait;
  use Carbon\Carbon;
  use Illuminate\Database\Eloquent\Model;
  use Illuminate\Database\Eloquent\SoftDeletes;
  
  class Attendance extends Model
  {
      use SoftDeletes, MultiTenantModelTrait;
  
      public $table = 'attendances';
  
      protected $dates = [
          'time_end',
          'time_start',
          'created_at',
          'updated_at',
          'deleted_at',
      ];
  
      protected $fillable = [
          'user_id',
          'time_end',
          'time_start',
          'place_start',
          'place_end',
          'created_at',
          'updated_at',
          'deleted_at',
      ];
  
      public function user()
      {
          return $this-&gt;belongsTo(User::class, 'user_id', 'id');
      }
  
      public function setTimeStartAttribute($value)
      {
          $this-&gt;attributes['time_start'] = $value ? Carbon::createFromFormat(config('panel.date_format') . ' ' . config('panel.time_format'), $value)-&gt;format('Y-m-d H:i:s') : null;
      }
  
      public function getTimeStartAttribute($value)
      {
          return $value ? Carbon::createFromFormat('Y-m-d H:i:s', $value)-&gt;format(config('panel.date_format') . ' ' . config('panel.time_format')) : null;
      }
  
      public function setTimeEndAttribute($value)
      {
          $this-&gt;attributes['time_end'] = $value ? Carbon::createFromFormat(config('panel.date_format') . ' ' . config('panel.time_format'), $value)-&gt;format('Y-m-d H:i:s') : null;
      }
  
      public function getTimeEndAttribute($value)
      {
          return $value ? Carbon::createFromFormat('Y-m-d H:i:s', $value)-&gt;format(config('panel.date_format') . ' ' . config('panel.time_format')) : null;
      }
  
      public function getDateStartAttribute()
      {
          return $this-&gt;time_start ? Carbon::createFromFormat('Y-m-d H:i:s', $this-&gt;time_start)-&gt;format(config('panel.date_format')) : null;
      }
  
      public function getTotalTimeAttribute()
      {
          $time_start = $this-&gt;time_start ? Carbon::createFromFormat('Y-m-d H:i:s', $this-&gt;time_start) : null;
          $time_end = $this-&gt;time_end ? Carbon::createFromFormat('Y-m-d H:i:s', $this-&gt;time_end) : null;
  
          return $this-&gt;time_end ? $time_end-&gt;diffInSeconds($time_start) : 0;
      }
      public function getTotalTimeChartAttribute()
      {
          return $this-&gt;total_time ? round($this-&gt;total_time/3600, 2) : 0;
      }
  }
  
  </code></pre>
  <p>This is my attendance model using laravel. I would like to do when a user clicks on the button, the time_start and location_start values are recieved and saved into database. This model is ok with time values and I don't know how to write for location values. Someone please help me in writing to get location values.</p>