Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

hasone relation in laravel

//Model Function
public function hasOneFunction(){
        return $this->hasOne('AppModelsModelName', 'targetedId');
    }
//in controller function
$data = ModelName::with('hasOneFunction')->get();
Source by laravel.com #
 
PREVIOUS NEXT
Tagged: #hasone #relation #laravel
ADD COMMENT
Topic
Name
6+8 =