Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeymezenin committed Jun 11, 2018
1 parent 17a2a96 commit 4277542
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
5 changes: 3 additions & 2 deletions README.md
Expand Up @@ -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~~
Expand Down Expand Up @@ -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)
Expand Down
11 changes: 6 additions & 5 deletions russian.md
Expand Up @@ -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;
}
Expand All @@ -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();
}
Expand Down Expand Up @@ -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()
{
Expand Down Expand Up @@ -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~~
Expand Down Expand Up @@ -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 }}
```

[🔝 Наверх](#Содержание)
Expand Down

0 comments on commit 4277542

Please sign in to comment.