Hung Thai
How can I get the parent Resource from RelationManager class?
Hi.
I'm having a
UserResource
class, which has the ContactRelationManager
.
In the Create/Edit/List pages of the UserResource
, I can use method like: self::getResource()
to point to the UserResource
class.
So, from the ContactRelationManager
class, how can I get the full path of the UserResource
class?
Thanks.6 replies
Display Table info with Recursive Relationship
Hi. I'm having hard-time trying to display nested relationship in the table.
For example, these 2 Models:
Category:
public function products() {
return $this->hasMany(Product::class);
}
and
Product:
public function category() {
if ($this->parent) {
//recursive to get the root category
return $this->parent->category();
}
return $this->belongsTo(Category::class);
}
public function parent() {
return $this->belongsTo(Product::class);
}
And then I had:
- Category id = 1 which had Product id = 1 as it's child.
- Product id = 1 which had Product id = 2 as it's child.
I can play around in tinker and extract the category from Product id 2 like:
\App\Models\Product::find(2)->category
, but somehow on the table, the relationship category of Product id 2 return null. My column like: Tables\Columns\TextColumn::make('category.name')
Product 1 show the category just fine, Product 2 just returned null.
How can I fix this? Thank you.2 replies
Call modal record view from anywhere.
Hi there.
I really appreciate the hard work of the creators and every one who contributed for this amazing package.
I'm curious how can I call the modal infolist from anywhere in the app?
For example:
I have the public static function infolist inside my PostResource to open a modal view.
How can I create an url/link inside Dashboard page to show the infolist modal for post id 1?
I know how to create a url redirect to a full-page, but haven't found out how to create a url to call the infolist modal.
Thank you so much.
14 replies