1. Go to this page and download the library: Download mpyw/eloquent-has-by-join 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/ */
mpyw / eloquent-has-by-join example snippets
class Post extends Model
{
use SoftDeletes;
}
class Comment extends Model
{
use SoftDeletes;
public function post(): BelongsTo
{
return $this->belongsTo(Post::class);
}
}