How would one type out $blah->save(); in php artisan if one is using MySQL?
How would one type out $blah->save(); in php artisan if one is using MySQL?
Everything was going smooth up until I typed $testone->save();
I got the following error
Illuminate\Database\QueryException with message 'SQLSTATE[42S02]: Base table or view not found: 1146 Table 'homestead.testones' doesn't exist (SQL: insert into testones (row, rowtwo, rowthree, rowfour, updated_at, created_at) values (My first row, My second row, My third row, My fourth row, 2016-01-08 18:24:53, 2016-01-08 18:24:53))'
Would it be MySQL Dump or something? Or some sort of insert quarry statement.
Have you created a database migration for your testone model? Have you run php artisan migrate? Your error message is indicating that there isn't a corresponding table for your model.
The first thing you want to do, is check your database - you're seeing an error that your table testones does not exist in your homestead database. I really hope I'm not coming across rude here, but the error is quite clear what's wrong - the errors are made to be as clear as possible to help you debug :)
If your table testones does not exist, then you need to run php artisan migrate as @jhoff suggested.
You'll get one of two messages, either "Nothing to migrate." - this means all of your migrations in your /database/migrations folder have been migrated to the database you specified.
Or, you'll receive a message saying that migration was successful. What do you get here?
Did you edit the migration before you ran php artisan migrate?
If not, that table will have only the default columns: id, created_at, and updated_at. Your earlier post indicates you were trying to save values to fields rowone, rowtwo, and rowthree. The way you wrote your example above is inserting three fields (columns) in the same record (row) i.e. you need to add those three columns to your migration before you run it.
Laravel Searches now for the Plural of "testone" so the database must be either named correctly "testones" or you need to pass the $table name to your model.