Skip to content

Instantly share code, notes, and snippets.

@uno-de-piera uno-de-piera/Post.php Secret
Created Jun 12, 2019

What would you like to do?
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Post extends Model {
protected $guarded = ['id'];
// cargamos siempre el usuario al obtener 1 post
protected $with = ['user'];
public function user () {
return $this->belongsTo(User::class);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.