Skip to content

Commit cd77954

Browse files
committed
update readme text and images
1 parent 12dfcec commit cd77954

7 files changed

Lines changed: 33 additions & 50 deletions

File tree

README.md

Lines changed: 33 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
![Banner](resources/imgs/banner.jpg "Banner")
22

3-
## Introduction
4-
Nova Inline Relationship is meant to present a relationship based property as an inline property for a Laravel Nova Resource. You are welcome to request or contribute by opening an issue.
5-
6-
![Nova Inline Relationship](screenshots/NovaInlineRelationship.png "Nova Inline Relationship")
3+
## Nova Inline Relationship
4+
Nova Inline Relationship is meant to present a relationship based property as an inline property for a Laravel Nova Resource.
75

86
## Requirements
97

@@ -19,85 +17,70 @@ composer require kirschbaum-development/nova-inline-relationship
1917

2018
## Usage
2119

22-
To use `NovaInlineRelationship` to your Model's resource all you need to do is to add an inline method to the regular syntax of your related Model's Resource.
20+
To use `NovaInlineRelationship` in your Model's resource all you need to do is to add an inline method to the regular syntax of your related Model's Resource field(s).
21+
22+
If we assume that a `BlogPost` model has a one-to-many relationship with `Image`, your `BlogPost` resource would like the following:
2323

24-
If we assume that an Employee Models has a one-to-one relationship with `EmployeeProfile` and one-to-many relationship with `EmployeeBill` model then the code will look like:
25-
2624
```php
2725
namespace App\Nova;
2826

29-
class Employee extends Resource
27+
class BlogPost extends Resource
3028
{
31-
3229
//...
3330
public function fields(Request $request)
3431
{
3532
return [
3633
//...
3734

38-
HasOne::make('Profile', 'profile', EmployeeProfile::class)->inline(),
39-
40-
HasMany::make('Bills', 'bills', EmployeeBill::class)->inline(),
35+
HasMany::make('Images', 'images', Image::class)->inline(),
4136
];
4237
}
4338
}
44-
```
45-
**_NOTE:_** You will need to add NovaResources for `EmployeeProfile` and `EmployeeBill` Model and all the field and rules will be fetch from it.
39+
```
40+
**_NOTE:_** You will need to add a Nova Resource for `Image` - all of the fields and rules will be retrieved from the specified resource. You must specify the resource as the third argument to the Relationship field.
4641

4742
## Adding related models
4843

4944
![Create View](screenshots/CreateView.png "Create View")
5045

51-
After setup you can add new related models directly while creating a new base model. For example, If you have added an `EmployeeProfile` model as a related model for your `Employee` model, you can infact add information for a related `EmployeeProfile` model without going through an additional step. You can use the `Add new Profile` button to add a new blank profile
46+
After setup you can add new related models directly while creating a new base model. You can use the `Add new Image` button to add a new `Image` to the `BlogPost`:
5247

5348
![Create Related Model](screenshots/CreateRelatedModel.png "Create Related Model")
5449

55-
## Adding multiple related models
56-
57-
If your relationship is a `one-to-many` relationship you can add multiple related models in a one go.
58-
59-
![Multiple Related Model](screenshots/MultipleRelatedModels.png "Multiple Related Model")
60-
6150
## Viewing related models
6251

63-
Once you add your related models and visit your base model's detail view you can watch your related models in a collapsible view. So when you will watch an `Employee` model, you can watch `EmployeeProfile` models in a collapsible view.
52+
Related models will also now be displayed inline as well:
6453

6554
![Detail View](screenshots/DetailView.png "Detail View")
6655

67-
## Updating related models
68-
69-
When you will edit your base model, you will be able to add, update and remove your related model's in a view similar to create form.
56+
## Updating related models
7057

71-
For `one-to-many` relationships you can drag and drop related models to rearrange them in relation to your base model.
58+
You can also update, re-arrange (for one-to-many relationships), and delete related models:
7259

7360
![Rearrange Models](screenshots/RearrangeModels.png "Rearrange Models")
7461

75-
## Deleting related models
76-
77-
You can delete related models from the base model's update view by using the `delete button` at the top right corner.
78-
7962
## Supported fields
8063

81-
You can use any field you can add to your Nova resource with `Field::make` syntax. The following native Nova 2.0 fields are confirmed to work.
82-
83-
- Boolean Field
84-
- Code Field
85-
- Country Field
86-
- Currency Field
87-
- Date Field
88-
- DateTime Field
89-
- Markdown Field
90-
- Number Field
91-
- Password Field
92-
- Place Field
93-
- Select Field
94-
- Text Field
95-
- Textarea Field
96-
- Timezone Field
97-
- Trix Field
98-
- Avatar Field
99-
- Image Field
100-
- File Field
64+
The following native Nova 2.0 fields are confirmed to work.
65+
66+
- Boolean
67+
- Code
68+
- Country
69+
- Currency
70+
- Date
71+
- DateTime
72+
- Markdown
73+
- Number
74+
- Password
75+
- Place
76+
- Select
77+
- Text
78+
- Textarea
79+
- Timezone
80+
- Trix
81+
- Avatar
82+
- Image
83+
- File
10184

10285
## Changelog
10386

screenshots/CreateRelatedModel.png

350 KB
Loading

screenshots/CreateView.png

206 KB
Loading

screenshots/DetailView.png

172 KB
Loading
-141 KB
Binary file not shown.
-37.5 KB
Binary file not shown.

screenshots/Validation.png

-46.4 KB
Binary file not shown.

0 commit comments

Comments
 (0)