initial commit

This commit is contained in:
Arno Kaimbacher 2015-07-19 13:49:24 +07:00
commit 28301e4312
219 changed files with 23035 additions and 0 deletions

51
app/Book.php Executable file
View file

@ -0,0 +1,51 @@
<?php namespace App;
use Illuminate\Database\Eloquent\Model;
class Book extends Model {
protected $fillable = [
'title',
'author',
'year',
'stock',
'category_id',
'shelf_id'
];
public function category()
{
return $this->belongsTo('App\Category');
}
public function shelf()
{
return $this->belongsTo('App\Shelf');
}
public function transactions()
{
return $this->hasMany('App\Transaction');
}
public function scopeAvailable($query)
{
return $query->where('stock', '>', 0);
}
public function scopeOrderByTitle($query)
{
return $query->orderBy('title');
}
}