PHP code example of jestillore / has-one-belongs-to

1. Go to this page and download the library: Download jestillore/has-one-belongs-to 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/ */

    

jestillore / has-one-belongs-to example snippets


class Course
{
    
}

class User
{
    use HasOneBelongsToRelationship;
    
    public function course()
    {
        return $this->hasOneBelongsTo(Course::class, 'student_data');
    }
}