PHP code example of axn / laravel-models-generator
1. Go to this page and download the library: Download axn/laravel-models-generator 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/ */
// "comments" table
class Comment extends Model
{
// "belongs to" relation to "users" via "user_id"
public function user() {}
// "belongs to" relation to "users" via "updator_id"
public function updator() {}
}
// "users" table
class User extends Model
{
// "has many" relation to "comments" via "user_id"
public function comments() {}
// "has many" relation to "comments" via "updator_id"
public function commentsViaUpdatorId() {}
}