first commit
This commit is contained in:
21
app/Models/Author.php
Normal file
21
app/Models/Author.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
|
||||
class Author extends Authenticatable {
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name',
|
||||
];
|
||||
|
||||
public function books() {
|
||||
return $this->belongsToMany(Book::class);
|
||||
}
|
||||
}
|
25
app/Models/Book.php
Normal file
25
app/Models/Book.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
|
||||
class Book extends Authenticatable {
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name',
|
||||
];
|
||||
|
||||
public function author() {
|
||||
return $this->hasMany(Author::class);
|
||||
}
|
||||
|
||||
public function location() {
|
||||
return $this->belongsTo(Location::class);
|
||||
}
|
||||
}
|
17
app/Models/Location.php
Normal file
17
app/Models/Location.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
|
||||
class Location extends Authenticatable {
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name',
|
||||
];
|
||||
}
|
Reference in New Issue
Block a user