Я новичок в laravel / php и надеялся, что кто-нибудь сможет ответить на вопрос для меня.Когда я тогда использую asset-> setDescription, здесь все работает нормально, но как только я раскомментирую 'protected $ description', метод setDescription перестает работать.Кто-нибудь знает, почему это происходит?
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Asset extends Model
{
protected $fillable = [
'type', 'title','origin',
];
// protected $description;
public function __construct($type, $title, $origin)
{
$this->setType($type);
$this->setTitle($title);
$this->setOrigin($origin);
}
// Setters
public function setType($type){
$this->type = $type;
}
public function setTitle($title)
{
$this->title = $title;
}
public function setOrigin($origin)
{
$this->origin = $origin;
}
public function setDescription($description)
{
$this->description = $description;
}
}
$type = $request->input('type');
$title = $request->input('title');
$origin = $request->input('origin');
// Create new asset
$asset = new Asset($type, $title, $origin);
$asset->setDescription('test');
$asset->save();```