From 62482b624d4a508baa5aae88a770ad0e0cb825e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=80=20?= =?UTF-8?q?=D0=91=D0=B0=D0=B1=D0=BA=D0=B8=D0=BD?= Date: Sun, 3 Jul 2022 16:46:35 +0300 Subject: [PATCH] add hasMany --- app/Models/Document.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/Models/Document.php b/app/Models/Document.php index 742e5b0..1ed1d2e 100644 --- a/app/Models/Document.php +++ b/app/Models/Document.php @@ -15,4 +15,10 @@ class Document extends Model 'name', 'parent_id', ]; + + public function childs() { + + return $this->hasMany('App\Category','parent_id','id') ; + + } }