404 :-( Страница не найдена! Нет результатов для модели [App \ Models \ City] 0 - PullRequest
0 голосов
/ 10 июля 2019

У меня проблема с моделями 404 :-( Страница не найдена! Нет результатов запроса для модели [App \ Models \ City] 0 Как это можно исправить? На локальной подаче У меня нет этой проблемы. Этопроисходит только на работающем сервере, тогда как на локальном хосте такая проблема не возникает.

herenamespace App\Models;

use App\Helpers\Number;
use App\Models\Scopes\ActiveScope;
use App\Models\Scopes\LocalizedScope;
use App\Models\Traits\CountryTrait;
use App\Observer\CityObserver;
use Larapen\Admin\app\Models\Crud;

класс City расширяет BaseModel {используйте Crud, CountryTrait;

/**
 * The table associated with the model.
 *
 * @var string
 */
protected $table = 'cities';

/**
 * The primary key for the model.
 *
 * @var string
 */
// protected $primaryKey = 'id';

/**
 * Indicates if the model should be timestamped.
 *
 * @var boolean
 */
public $timestamps = true;

/**
 * The attributes that aren't mass assignable.
 *
 * @var array
 */
// protected $guarded = ['id'];

/**
 * The attributes that are mass assignable.
 *
 * @var array
 */
protected $fillable = [
    'id',
    'country_code',
    'name',
    'asciiname',
    'latitude',
    'longitude',
    'subadmin1_code',
    'subadmin2_code',
    'population',
    'time_zone',
    'active',
];

/**
 * The attributes that should be hidden for arrays
 *
 * @var array
 */
// protected $hidden = [];

/**
 * The attributes that should be mutated to dates.
 *
 * @var array
 */
protected $dates = ['created_at', 'updated_at'];

/*
|--------------------------------------------------------------------------
| FUNCTIONS
|--------------------------------------------------------------------------
*/
protected static function boot()
{
    parent::boot();

    City::observe(CityObserver::class);

    static::addGlobalScope(new ActiveScope());
    static::addGlobalScope(new LocalizedScope());
}

public function getAdmin2Html()
{
    $out = $this->subadmin2_code;

    if (isset($this->subAdmin2) && !empty($this->subAdmin2)) {
        $out = $this->subAdmin2->name;
    }

    return $out;
}

public function getAdmin1Html()
{
    $out = $this->subadmin1_code;

    if (isset($this->subAdmin1) && !empty($this->subAdmin1)) {
        $out = $this->subAdmin1->name;
    }

    return $out;
}

/*
|--------------------------------------------------------------------------
| RELATIONS
|--------------------------------------------------------------------------
*/
public function posts()
{
    return $this->hasMany(Post::class, 'city_id');
}

public function subAdmin2()
{
    return $this->belongsTo(SubAdmin2::class, 'subadmin2_code', 'code');
}

public function subAdmin1()
{
    return $this->belongsTo(SubAdmin1::class, 'subadmin1_code', 'code');
}

/*
|--------------------------------------------------------------------------
| SCOPES
|--------------------------------------------------------------------------
*/

/*
|--------------------------------------------------------------------------
| ACCESSORS
|--------------------------------------------------------------------------
*/
public function getAsciinameAttribute($value)
{
    return preg_replace(['#\s\s+#ui', '#\' #ui'], [' ', "'"], $value);
}

public function getLatitudeAttribute($value)
{
    return Number::toFloat($value);
}

public function getLongitudeAttribute($value)
{
    return Number::toFloat($value);
}

ссылка для ошибки https://www.clusify.com/en/free-ads/new-york-city/5128581

404 :-( Страница не найдена! Нет результатов запроса для модели [App \ Models \ City] 0 Как это можно исправить? На локальной подаче Я не получаю эту проблему. Это происходит только наживой сервер, который находится на общем хостинге.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...