Hi!
I'm following Jeffreys Project Flyer and now in episode 16 I'm stuck because I get this error when I want to create a new flyer:
ErrorException in FlyersController.php line 52:
Undefined variable: flyer
& when I when I want to add photos I get his one:
Call to undefined method Illuminate\Database\Query\Builder::fileName()
at Model->__call('fileName', array()) in AddPhotoToFlyer.php line 46
at Photo->fileName() in AddPhotoToFlyer.php line 46
I rewatched the video several times but I don't find the error which is very frustrating. Maybe someone has it on Github and can point me there? :) I found repositories but unfortunately they are outdated.
Anyway, here are my methods, they look exactly like in Jeffreys video:
// Line 52 is the return statement
public function store(FlyerRequest $request)
{
$this->user->publish(
new Flyer($request->all())
);
return redirect(flyer_path($flyer));
}
// The helper class:
function flyer_path(App\Flyer $flyer)
{
return $this->zip .'/'. str_replace(' ', '-', $this->address);
}
And line 46 from my second error looks like this.
public function save()
{
$photo = $this->flyer->addPhoto($this->makePhoto());
$this->file->move($photo->baseDir(), $photo->name);
$this->thumbnail->make($photo->path, $photo->thumbnail_path);
}
Does anyone also encountered this/these errors and could give me some advice? Unfortunately I cannot find this project under Jeffreys Github account :(
Happy Weekend!