-
Notifications
You must be signed in to change notification settings - Fork 0
HW4 is completed #45
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
aik27
wants to merge
2
commits into
AKazarmshchikov/hw3
Choose a base branch
from
AKazarmshchikov/hw4
base: AKazarmshchikov/hw3
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
HW4 is completed #45
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace App\Models; | ||
|
|
||
| use Illuminate\Database\Eloquent\Model; | ||
|
|
||
| /** | ||
| * | ||
| * | ||
| * @method static \Illuminate\Database\Eloquent\Builder<static>|BaseModel newModelQuery() | ||
| * @method static \Illuminate\Database\Eloquent\Builder<static>|BaseModel newQuery() | ||
| * @method static \Illuminate\Database\Eloquent\Builder<static>|BaseModel query() | ||
| * @mixin \Eloquent | ||
| */ | ||
| class BaseModel extends Model {} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace App\Models; | ||
|
|
||
| use Eloquent; | ||
| use Illuminate\Database\Eloquent\Relations\MorphOne; | ||
| use Illuminate\Support\Carbon; | ||
|
|
||
| /** | ||
| * Категории объявлений | ||
| * | ||
| * @property int $id | ||
| * @property string $name Название категории | ||
| * @property Carbon|null $created_at | ||
| * @property Carbon|null $updated_at | ||
| * @method static \Illuminate\Database\Eloquent\Builder<static>|Category newModelQuery() | ||
| * @method static \Illuminate\Database\Eloquent\Builder<static>|Category newQuery() | ||
| * @method static \Illuminate\Database\Eloquent\Builder<static>|Category query() | ||
| * @method static \Illuminate\Database\Eloquent\Builder<static>|Category whereCreatedAt($value) | ||
| * @method static \Illuminate\Database\Eloquent\Builder<static>|Category whereId($value) | ||
| * @method static \Illuminate\Database\Eloquent\Builder<static>|Category whereName($value) | ||
| * @method static \Illuminate\Database\Eloquent\Builder<static>|Category whereUpdatedAt($value) | ||
| * @property-read Image $image | ||
| * @mixin Eloquent | ||
| */ | ||
| class Category extends BaseModel | ||
| { | ||
| protected $fillable = [ | ||
| 'name', | ||
| ]; | ||
| protected $hidden = [ | ||
| 'created_at', | ||
| 'updated_at', | ||
| ]; | ||
|
|
||
| public function image(): MorphOne | ||
| { | ||
| return $this->morphOne(Image::class, 'image'); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace App\Models; | ||
|
|
||
| use Eloquent; | ||
| use Illuminate\Database\Eloquent\Relations\BelongsTo; | ||
| use Illuminate\Support\Carbon; | ||
|
|
||
| /** | ||
| * Города | ||
| * | ||
| * @property int $id | ||
| * @property string $name Название города | ||
| * @property string $latitude Широта | ||
| * @property string $longitude Долгота | ||
| * @property int $timezone Часовой пояс | ||
| * @property int $country_id | ||
| * @property int $region_id | ||
| * @property Carbon|null $created_at | ||
| * @property Carbon|null $updated_at | ||
| * @method static \Illuminate\Database\Eloquent\Builder<static>|City newModelQuery() | ||
| * @method static \Illuminate\Database\Eloquent\Builder<static>|City newQuery() | ||
| * @method static \Illuminate\Database\Eloquent\Builder<static>|City query() | ||
| * @method static \Illuminate\Database\Eloquent\Builder<static>|City whereCountryId($value) | ||
| * @method static \Illuminate\Database\Eloquent\Builder<static>|City whereCreatedAt($value) | ||
| * @method static \Illuminate\Database\Eloquent\Builder<static>|City whereId($value) | ||
| * @method static \Illuminate\Database\Eloquent\Builder<static>|City whereLatitude($value) | ||
| * @method static \Illuminate\Database\Eloquent\Builder<static>|City whereLongitude($value) | ||
| * @method static \Illuminate\Database\Eloquent\Builder<static>|City whereName($value) | ||
| * @method static \Illuminate\Database\Eloquent\Builder<static>|City whereRegionId($value) | ||
| * @method static \Illuminate\Database\Eloquent\Builder<static>|City whereTimezone($value) | ||
| * @method static \Illuminate\Database\Eloquent\Builder<static>|City whereUpdatedAt($value) | ||
| * @property-read Country $country | ||
| * @property-read Region $region | ||
| * @mixin Eloquent | ||
| */ | ||
| class City extends BaseModel | ||
| { | ||
| protected $fillable = [ | ||
| 'name', | ||
| 'latitude', | ||
| 'longitude', | ||
| 'timezone', | ||
| 'country_id', | ||
| 'region_id', | ||
| ]; | ||
| protected $hidden = [ | ||
| 'created_at', | ||
| 'updated_at', | ||
| ]; | ||
|
|
||
| public function country(): BelongsTo | ||
| { | ||
| return $this->belongsTo(Country::class); | ||
| } | ||
|
|
||
| public function region(): BelongsTo | ||
| { | ||
| return $this->belongsTo(Region::class); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace App\Models; | ||
|
|
||
| use Eloquent; | ||
| use Illuminate\Database\Eloquent\Collection; | ||
| use Illuminate\Database\Eloquent\Relations\HasMany; | ||
| use Illuminate\Support\Carbon; | ||
|
|
||
| /** | ||
| * Страны | ||
| * | ||
| * @property int $id | ||
| * @property string $name Название страны | ||
| * @property string $code | ||
| * @property Carbon|null $created_at | ||
| * @property Carbon|null $updated_at | ||
| * @method static \Illuminate\Database\Eloquent\Builder<static>|Country newModelQuery() | ||
| * @method static \Illuminate\Database\Eloquent\Builder<static>|Country newQuery() | ||
| * @method static \Illuminate\Database\Eloquent\Builder<static>|Country query() | ||
| * @method static \Illuminate\Database\Eloquent\Builder<static>|Country whereCode($value) | ||
| * @method static \Illuminate\Database\Eloquent\Builder<static>|Country whereCreatedAt($value) | ||
| * @method static \Illuminate\Database\Eloquent\Builder<static>|Country whereId($value) | ||
| * @method static \Illuminate\Database\Eloquent\Builder<static>|Country whereName($value) | ||
| * @method static \Illuminate\Database\Eloquent\Builder<static>|Country whereUpdatedAt($value) | ||
| * @property-read Collection<int, City> $cities | ||
| * @property-read int|null $cities_count | ||
| * @property-read Collection<int, Region> $regions | ||
| * @property-read int|null $regions_count | ||
| * @mixin Eloquent | ||
| */ | ||
| class Country extends BaseModel | ||
| { | ||
| protected $fillable = [ | ||
| 'name', | ||
| 'code', | ||
| ]; | ||
| protected $hidden = [ | ||
| 'created_at', | ||
| 'updated_at', | ||
| ]; | ||
|
|
||
| public function regions(): HasMany | ||
| { | ||
| return $this->hasMany(Region::class); | ||
| } | ||
|
|
||
| public function cities(): HasMany | ||
| { | ||
| return $this->hasMany(City::class); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace App\Models; | ||
|
|
||
| use Eloquent; | ||
| use Illuminate\Support\Carbon; | ||
|
|
||
| /** | ||
| * Валюты | ||
| * | ||
| * @property int $id | ||
| * @property string $name Название валюты | ||
| * @property string $code Код | ||
| * @property string $char Символ | ||
| * @property Carbon|null $created_at | ||
| * @property Carbon|null $updated_at | ||
| * @method static \Illuminate\Database\Eloquent\Builder<static>|Currency newModelQuery() | ||
| * @method static \Illuminate\Database\Eloquent\Builder<static>|Currency newQuery() | ||
| * @method static \Illuminate\Database\Eloquent\Builder<static>|Currency query() | ||
| * @method static \Illuminate\Database\Eloquent\Builder<static>|Currency whereChar($value) | ||
| * @method static \Illuminate\Database\Eloquent\Builder<static>|Currency whereCode($value) | ||
| * @method static \Illuminate\Database\Eloquent\Builder<static>|Currency whereCreatedAt($value) | ||
| * @method static \Illuminate\Database\Eloquent\Builder<static>|Currency whereId($value) | ||
| * @method static \Illuminate\Database\Eloquent\Builder<static>|Currency whereName($value) | ||
| * @method static \Illuminate\Database\Eloquent\Builder<static>|Currency whereUpdatedAt($value) | ||
| * @mixin Eloquent | ||
| */ | ||
| class Currency extends BaseModel | ||
| { | ||
| protected $fillable = [ | ||
| 'name', | ||
| 'code', | ||
| 'char', | ||
| ]; | ||
| protected $hidden = [ | ||
| 'created_at', | ||
| 'updated_at', | ||
| ]; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace App\Models; | ||
|
|
||
| use Database\Factories\ImageFactory; | ||
| use Eloquent; | ||
| use Illuminate\Database\Eloquent\Factories\HasFactory; | ||
| use Illuminate\Database\Eloquent\Relations\MorphTo; | ||
| use Illuminate\Support\Carbon; | ||
|
|
||
| /** | ||
| * Изображения | ||
| * | ||
| * @property int $id | ||
| * @property string $path Путь к изображению | ||
| * @property bool $main Основное изображение | ||
| * @property string $image_type | ||
| * @property int $image_id | ||
| * @property Carbon|null $created_at | ||
| * @property Carbon|null $updated_at | ||
| * @method static ImageFactory factory($count = null, $state = []) | ||
| * @method static \Illuminate\Database\Eloquent\Builder<static>|Image newModelQuery() | ||
| * @method static \Illuminate\Database\Eloquent\Builder<static>|Image newQuery() | ||
| * @method static \Illuminate\Database\Eloquent\Builder<static>|Image query() | ||
| * @method static \Illuminate\Database\Eloquent\Builder<static>|Image whereCreatedAt($value) | ||
| * @method static \Illuminate\Database\Eloquent\Builder<static>|Image whereId($value) | ||
| * @method static \Illuminate\Database\Eloquent\Builder<static>|Image whereImageId($value) | ||
| * @method static \Illuminate\Database\Eloquent\Builder<static>|Image whereImageType($value) | ||
| * @method static \Illuminate\Database\Eloquent\Builder<static>|Image whereMain($value) | ||
| * @method static \Illuminate\Database\Eloquent\Builder<static>|Image wherePath($value) | ||
| * @method static \Illuminate\Database\Eloquent\Builder<static>|Image whereUpdatedAt($value) | ||
| * @method static \Illuminate\Database\Eloquent\Builder<static>|Image whereUserId($value) | ||
| * @property-read \Illuminate\Database\Eloquent\Model|\Eloquent $image | ||
| * @mixin Eloquent | ||
| */ | ||
| class Image extends BaseModel | ||
| { | ||
| /** @use HasFactory<ImageFactory> */ | ||
| use hasFactory; | ||
|
|
||
| protected $fillable = [ | ||
| 'path', | ||
| 'main', | ||
| 'image_type', | ||
| 'image_id', | ||
| ]; | ||
|
|
||
| public function image(): MorphTo | ||
| { | ||
| return $this->morphTo(); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Зачем вам пустой базовый класс?
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.
На случай, если нужно будет что-то добавить во все модели сразу. Не знаю, логирование какое-нибудь.