-
-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
doc blocks for resources #7
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Спасибо! Круто, есть пара мелочей
public function title(): string; | ||
|
||
/** | ||
* Define a field, which will be used in relations as a foreign key |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не ключ а поле которое будет отображаться в отношениях во view (скажем если это Select и связь со странанми то отображаем название страны и к примеру это поле name) foreign key мы берем автоматом из отношения
/** | ||
* Check whether user can perform action on model | ||
* | ||
* @param string $ability create/update/delete/massDelete |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
view, viewAny, restore, forceDelete
/** | ||
* Creates a form element class: Field,Filter | ||
* | ||
* @param ...$arguments $label Form element label will be displayed in moonshine admin panel, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Здесь бы по подробнее, смотри что за аргументы
$label = тут все ясно form element label
$field = Поле в таблице либо метод отношений если это поле для реализации отношения
$resource = Если это реализация отношения то служит для указания titleField, либо можно передать сам ресурс в котором указан titleField, либо можно передать функцию и задать titleField более подробно
BelongsTo::make('Страна', 'country', fn(Model $item) => $item->id . ' ' . $item->name)
some phpDoc for ResourceСontract and Resource base class