I am extremely new to Laravel (like 2 days in learning it) and I've worked my through most of the Intro to Laravel laracast.
I thought today i'd give a my own project a go.
I want to be able to use an existing table in Laravel. For instance, I have a bible table called 'kjv'. It has the following columns:
CREATE TABLE `kjv` (
`id` int(11) NOT NULL,
`book` varchar(140) COLLATE utf8mb4_unicode_ci NOT NULL,
`chapter` smallint(6) DEFAULT NULL,
`verse` int(11) DEFAULT NULL,
`contents` mediumtext COLLATE utf8mb4_unicode_ci,
`in-red` mediumtext COLLATE utf8mb4_unicode_ci,
`all-red` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
And i've imported that into my laravel database.
The thing is, I dont want to create a new migration, as that would overwrite the data.
I want to be able to use the data in my project, so how would I go about this? I'm guessing I need a model, but I have no idea what i'd write in there. Do I need a controller also?
I'd like to be able to start with a 'get verse' function in the model, so lets say, something along the lines of:
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use App\KJV;
class KJV extends Model
{
//
public function verse($id) {
$verse = KJV::find($id);
return view("verse");
}
}
Of course, I'm really guessing here. Any help would be greatly appreciated.