7e1cd96bf5
This is the first part of the API. It supports most of contacts, as well as the journal. This PR also brings Monica to Laravel 5.5, as the API required it with the new concept of resources. It needs to run `php artisan migrate` as well as `php artisan passport:keys` to generate the access tokens needed for the API.
23 lines
460 B
PHP
23 lines
460 B
PHP
<?php
|
|
|
|
namespace App;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class ApiUsage extends Model
|
|
{
|
|
protected $table = 'api_usage';
|
|
|
|
/**
|
|
* Log a request made through the API.
|
|
* @param Request $request
|
|
*/
|
|
public function log(\Illuminate\Http\Request $request)
|
|
{
|
|
$this->url = $request->fullUrl();
|
|
$this->method = $request->getMethod();
|
|
$this->client_ip = $request->getClientIp();
|
|
$this->save();
|
|
}
|
|
}
|