Created
April 16, 2020 06:52
-
-
Save Cerwyn/72dae0a2c81daa9843446b5f69149547 to your computer and use it in GitHub Desktop.
One-to-many
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App; | |
use Illuminate\Database\Eloquent\Model; | |
class Comment extends Model | |
{ | |
protected $fillable = [ | |
'text', 'star' | |
]; | |
public function article(){ | |
return $this->belongsTo('App\Article'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment