I am trying to update my database using Eloquent model but the class is not recognized.
First I created my table using migration and that worked fine.. Below is the code use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration;
class CreatePaintings extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('paintings',function($thepainting){
$thepainting->increments('id');
$thepainting->string('title');
$thepainting->string('artist');
$thepainting->integer('year');
$thepainting->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('paintings');
}
}
Next, I created a class "paint" using the model. But note that the recent version of laravel don't have the model folder specified explicitly. So when I ran the code below on the command prompt I was able to create the paint class
php artisan make:model paint
Lastly, I tried updating the created table, paintings, via routes.php using the code below..
Route::get('/', function()
{
$paintings = new Paint;
$paintings->title = 'Emmanuel';
$paintings->artist = 'D. DoRight';
$painitngs->year = 2014;
$paintings->save();
return view('trynn');
});
Route::get('about/directions', function()
{
return "Direction content goes here";
});
Route::get('about/{theSubject}', function($theSubject)
{
return $theSubject. " content goes here";
});
please I am new to laravel, so I will appreciate any help to get this resolved. I am presently stranded. Lest I forget, The error message is shown below
Whoops, looks like something went wrong.
1/1 FatalErrorException in routes.php line 18: Class 'Paint' not found