Advertisement
Guest User

Author Model

a guest
Feb 25th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.28 KB | None | 0 0
  1. <?php
  2.  
  3. namespace App;
  4.  
  5. use Illuminate\Database\Eloquent\Model;
  6. use App\Book;
  7.  
  8. class Author extends Model
  9. {
  10.     protected $fillable = [
  11.         'name','email','nationality'];
  12.  
  13.         //One author to many book
  14.  
  15.     public function books()
  16.     {
  17.         return $this->hasMany(Book::class);
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement