In the process of learning Laravel and following along with the video tutorials. During episode 11 @ 18 minutes 30 seconds in here.
- The instructor creates a new file Model.php inside the app directory.
- The new Model.php now extends Eloquent
- Inside the new Model.php he adds
protected $guarded = [];
- He then extends the Post.php to the new Model.php
This allows him to define all the guarded fields in the new Model.php when doing a mass submission in his form. However when I fo this I still get a mass assignment exception.
If I change the Model.php to Models.php (notice the extra 's') then it works. I'm wondering why I can't have another file name Model.php inside the app directory to extend to?
<?php
namespace App;
use Illuminate\Database\Eloquent\Model as Eloquent;
class Model extends Eloquent
{
protected $guarded = [];
}