Skip to content

Update eloquent.md #403

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

Open
wants to merge 1 commit into
base: 11.x
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions eloquent.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ php artisan make:model Flight -crR
# Создать модель и класс FlightPolicy class...
php artisan make:model Flight --policy

# Создать модель, миграцию, фабрику, наполнитель и контроллер ...
# Создать модель, миграцию, фабрику, наполнитель и контроллер...
php artisan make:model Flight -mfsc

# Создать модель, миграцию, фабрику, наполнитель, политику, контроллер и запрос формы ...
# Создать модель, миграцию, фабрику, наполнитель, политику, контроллер и запрос формы...
php artisan make:model Flight --all
php artisan make:model Flight -a

Expand Down Expand Up @@ -195,15 +195,15 @@ Eloquent требует, чтобы каждая модель имела по к
use Ramsey\Uuid\Uuid;

/**
* Generate a new UUID for the model.
* Создаем новый UUID для модели.
*/
public function newUniqueId(): string
{
return (string) Uuid::uuid4();
}

/**
* Get the columns that should receive a unique identifier.
* Получаем столбцы, которым должен быть присвоен уникальный идентификатор.
*
* @return array<int, string>
*/
Expand All @@ -224,7 +224,7 @@ Eloquent требует, чтобы каждая модель имела по к
// ...
}

$article = Article::create(['title' => 'Traveling to Asia']);
$article = Article::create(['title' => 'Путешествие в Азию']);

$article->id; // "01gd4d3tgrrfqeda94gdbtdk5c"

Expand Down Expand Up @@ -1048,7 +1048,7 @@ Eloquent содержит методы `isDirty`, `isClean` и `wasChanged` дл
Помечая модели как `Prunable`, вы также можете определить метод `pruning` для модели. Этот метод будет вызван перед удалением модели. Этот метод может быть полезен для удаления любых дополнительных ресурсов, связанных с моделью, таких как хранимые файлы, до того, как модель будет окончательно удалена из базы данных:

/**
* Prepare the model for pruning.
* Подготока модели к удалению.
*/
protected function pruning(): void
{
Expand Down Expand Up @@ -1100,7 +1100,7 @@ php artisan model:prune --pretend
use MassPrunable;

/**
* Get the prunable model query.
* Получаем запрос сокращаемой модели.
*/
public function prunable(): Builder
{
Expand Down