Good morning. I am currently in Laravel making an application for the management of a library and when entering the model a method to upload a file I get this error:
FatalErrorException in Libro.php line 12: syntax error, unexpected 'public' (T_PUBLIC) in Libro.php line 12
Here is my model and I do not see any syntax error:
<?php namespace Biblioteca;
use Illuminate\Database\Eloquent\Model;
use Carbon\Carbon;
class Libro extends Model
{
protected $table = "libros";
protected $fillable = ['titulo','path', 'idioma','paginas','tipo','categoria', 'fecha_lanzamiento', 'descripcion','enlace','categoria_id'];
}
public function setPathAttribute($path)
{
if(! empty($path)){
$titulo = Carbon::now()->second.$path->getClientOriginalName();
$this->attributes['path'] = $titulo;
\Storage::disk('local')->put($titulo, \File::get($path));
}
}
If you need to see the controller and the input method, I'll pass it.