1. Go to this page and download the library: Download morbihanet/modeler library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
morbihanet / modeler example snippets
namespace App\Models;
use Morbihanet\Modeler\Modeler;
class Book extends Modeler {}
namespace App\Models;
use Morbihanet\Modeler\Modeler;
class Author extends Modeler {}
use App\Models\Author;
use App\Models\Book;
$author = Author::create(['lastname' => 'Hugo', 'firstname' => 'Victor']);
Book::create(['title' => 'Notre Dame de Paris', 'author_id' => $author->id]);
namespace App\Http\Controllers;
use App\Models\Author;
use App\Models\Book;
class HomeController extends Controller
{
public function index()
{
$victorHugo = Author::find(1);
$books = $victorHugo->books;
return view('home', compact('victorHugo', 'books'));
}
}