From 4277542133c229045bb402391633981ef2b31549 Mon Sep 17 00:00:00 2001 From: Alexey Mezenin Date: Mon, 11 Jun 2018 14:50:00 +0200 Subject: [PATCH] Fixes --- README.md | 5 +++-- russian.md | 11 ++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index f1b1836..37ba9bb 100644 --- a/README.md +++ b/README.md @@ -453,6 +453,7 @@ All other relationships | plural | articleComments | ~~articleComment, article_c Table | plural | article_comments | ~~article_comment, articleComments~~ Pivot table | singular model names in alphabetical order | article_user | ~~user_article, articles_users~~ Table column | snake_case without model name | meta_title | ~~MetaTitle; article_meta_title~~ +Model property | snake_case | $model->created_at | ~~$model->createdAt~~ Foreign key | singular model name with _id suffix | article_id | ~~ArticleId, id_article, articles_id~~ Primary key | - | id | ~~custom_id~~ Migration | - | 2017_01_01_000000_create_articles_table | ~~2017_01_01_000000_articles~~ @@ -571,14 +572,14 @@ Good: ```php // Model protected $dates = ['ordered_at', 'created_at', 'updated_at'] -public function getMonthDayAttribute($date) +public function getSomeDateAttribute($date) { return $date->format('m-d'); } // View {{ $object->ordered_at->toDateString() }} -{{ $object->ordered_at->monthDay }} +{{ $object->ordered_at->some_date }} ``` [πŸ” Back to contents](#contents) diff --git a/russian.md b/russian.md index 24c634f..e6d5b0f 100644 --- a/russian.md +++ b/russian.md @@ -50,7 +50,7 @@ public function getFullNameAttribute() { if (auth()->user() && auth()->user()->hasRole('client') && auth()->user()->isVerified()) { - return 'Mr. ' . $this->first_name . ' ' . $this->middle_name . ' ' $this->last_name; + return 'Mr. ' . $this->first_name . ' ' . $this->middle_name . ' ' . $this->last_name; } else { return $this->first_name[0] . '. ' . $this->last_name; } @@ -65,7 +65,7 @@ public function getFullNameAttribute() return $this->isVerifiedClient() ? $this->getFullNameLong() : $this->getFullNameShort(); } -public function isVerfiedClient() +public function isVerifiedClient() { return auth()->user() && auth()->user()->hasRole('client') && auth()->user()->isVerified(); } @@ -110,7 +110,7 @@ public function index() return view('index', ['clients' => $this->client->getWithNewOrders()]); } -Class Client extends Model +class Client extends Model { public function getWithNewOrders() { @@ -449,6 +449,7 @@ e2e тСстированиС | Laravel Dusk | Codeception Π’Π°Π±Π»ΠΈΡ†Π° | ΠΌΠ½. Ρ‡. | article_comments | ~~article_comment, articleComments~~ Pivot Ρ‚Π°Π±Π»ΠΈΡ†Π° | ΠΈΠΌΠ΅Π½Π° ΠΌΠΎΠ΄Π΅Π»Π΅ΠΉ Π² Π°Π»Ρ„Π°Π²ΠΈΡ‚Π½ΠΎΠΌ порядкС Π² Π΅Π΄. Ρ‡. | article_user | ~~user_article, articles_users~~ Π‘Ρ‚ΠΎΠ»Π±Π΅Ρ† Π² Ρ‚Π°Π±Π»ΠΈΡ†Π΅ | snake_case Π±Π΅Π· ΠΈΠΌΠ΅Π½ΠΈ ΠΌΠΎΠ΄Π΅Π»ΠΈ | meta_title | ~~MetaTitle; article_meta_title~~ +Бвойство ΠΌΠΎΠ΄Π΅Π»ΠΈ | snake_case | $model->created_at | ~~$model->createdAt~~ Π’Π½Π΅ΡˆΠ½ΠΈΠΉ ΠΊΠ»ΡŽΡ‡ | имя ΠΌΠΎΠ΄Π΅Π»ΠΈ Π΅Π΄. Ρ‡. ΠΈ _id | article_id | ~~ArticleId, id_article, articles_id~~ ΠŸΠ΅Ρ€Π²ΠΈΡ‡Π½Ρ‹ΠΉ ΠΊΠ»ΡŽΡ‡ | - | id | ~~custom_id~~ ΠœΠΈΠ³Ρ€Π°Ρ†ΠΈΡ | - | 2017_01_01_000000_create_articles_table | ~~2017_01_01_000000_articles~~ @@ -568,14 +569,14 @@ $apiKey = config('api.key'); // МодСль protected $dates = ['ordered_at', 'created_at', 'updated_at'] // Π§ΠΈΡ‚Π°Ρ‚Π΅Π»ΡŒ (accessor) -public function getMonthDayAttribute($date) +public function getSomeDateAttribute($date) { return $date->format('m-d'); } // Π¨Π°Π±Π»ΠΎΠ½ {{ $object->ordered_at->toDateString() }} -{{ $object->ordered_at->monthDay }} +{{ $object->ordered_at->some_date }} ``` [πŸ” НавСрх](#Π‘ΠΎΠ΄Π΅Ρ€ΠΆΠ°Π½ΠΈΠ΅)