blue-twilight/app/Album.php

38 lines
699 B
PHP

<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Http\Request;
use Illuminate\Notifications\Notifiable;
class Album extends Model
{
use Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name', 'description'
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
];
public static function fromRequest(Request $request)
{
$album = new Album();
$album->name = $request->get('name');
$album->description = $request->get('description');
return $album;
}
}