Skip to content

Instantly share code, notes, and snippets.

@emmadesilva
Created March 12, 2022 17:43
Show Gist options
  • Select an option

  • Save emmadesilva/7ec39b453196d7e2bcdadacf7c439246 to your computer and use it in GitHub Desktop.

Select an option

Save emmadesilva/7ec39b453196d7e2bcdadacf7c439246 to your computer and use it in GitHub Desktop.
Tie-in gist with API blog post #3
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Log extends Model
{
/**
* Indicates if the model should be timestamped.
*
* @var bool
*/
public $timestamps = false;
/**
* Get the user that owns the Log
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function user(): \Illuminate\Database\Eloquent\Relations\BelongsTo
{
return $this->belongsTo(User::class);
}
/**
* Get the team that owns the Log
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function team(): \Illuminate\Database\Eloquent\Relations\BelongsTo
{
return $this->belongsTo(Team::class);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment