Laravel relation provides almost all feature to create the database schema and one of best feature is create relations in laravel migration. As We know relations are used to create the associations between the tables and there is three types of relations in mysql which is one-to-one, one-to-many, and many-to-many….
Tag: relation
How to Use hasOne Relationship in Laravel with Example ?
hasOne relationship in laravel is used to create the relation between two tables. hasOne means create the relation one to one. For example if a article has comments and we wanted to get one comment with the article details then we can use hasOne relationship or a user can have…
How to Use hasMany Relationship in Laravel with Example ?
Laravel hasMany relationship is used to create the relation between two tables. hasMany means create the relation one to Many. For example if a article have comments and we wanted to get all comments of the article then we can use hasMany relationship . Database Relations are used to create…
How to Use Laravel belongsTo Relationship in with Example ?
Laravel BelongsTo relationship is used to create the relation between two tables. belongsTo means create the relation one to one in inverse direction or its opposite of hasOne. For example if a user has a profile and we wanted to get profile with the user details then we can use…