Closed jellesimons closed 4 years ago
I just upgraded to: PHP 7.2.24 Laravel version 5.8.35 exodusanto/administrator version: 5.8.0
and pages in Admin that were working for years are now broken (same error). Please respond when you have a chance. I'm not positive the solution is what the previous author outlined, but the error exists nonetheless.
Can someone share an example of model configuration?
Hi exodusanto, Thank you for replying. It seems like you're not experiencing it at all? It's actually broken every page I've created. And this didn't occur when I upgraded to 5.8, it's when I upgraded to PHP 7.2.24.
I'll provide a model configuration shortly.
Thank you.
I'm recently push on develop
branch the update of methods name.
Can you try the fix? In your composer.json
add the VCS section and update the package version to dev-develop
review.php:
`<?php
namespace App;
/*
require_once('uploadable.class.php');
class Review extends Uploadable {
/**
* Ardent validation rules
*/
public static $rules = [
'reservation_id' => 'required',
'title' => 'required',
'score' => 'required|integer|between:1,10',
];
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'reviews';
// MASS ASSIGNMENT -------------------------------------------------------
// define which attributes are mass assignable (for security)
// we only want these 2 attributes able to be filled
protected $fillable = ['reservation_id', 'title', 'blurb', 'score', 'reviewed'];
public static function boot()
{
parent::boot();
static::updating(function ($review) {
// Set reviewed_on timestamp if it's being changed to 'reviewed'
if ($review->reviewed && $review->isDirty(['reviewed'])) {
$review->reviewed_on = date('Y-m-d H:i:s');
}
});
}
public function reservation()
{
return $this->belongsTo('App\reservation');
}
} ` reviews.php:
`<?php /*
Window - Preferences - PHPeclipse - PHP - Code Templates */
return array(
/**
/**
/**
/**
'filters' => array(
'reviewed' => array(
'title' => 'Reviewed?',
'type' => 'bool',
),
),
/**
'permission'=> function() { $admin_exists = \App\Roleuser::where('role_id', '=', 1)->first(); if ( !is_null($admin_exists) ) { return (Auth::check() && (Auth::user()->hasRole('Admin') || Auth::user()->hasRole('Provider'))); } else { return true; } },
'action_permissions'=> array( 'create' => function($model) { return true; }, 'delete' => function($model) { return true; }, 'update' => function($model) { return true; }, ),
'sort' => array( 'field' => 'created_at', 'direction' => 'desc', ),
)
?> `
Yes, that version is working as expected. Thank you for the fix. Let me know when it's committed.
Fixed in version 5.8.1
Laravel version: 5.8.35 PHP version: 7.2.22 exodusanto/administrator version: 5.8.0
There is a problem with two method names inherited from Illuminate/Database/Eloquent/Relations/Relation.php
Method getOwnerKey() is named getOwnerKeyName() and method getForeignKey() is named getForeignKeyName().
In file Fields/Relationships/BelongsTo.php:
line 32: $options['foreign_key'] = $relationship->getForeignKeyName();
In File Columns/Relationships/BelongsTo.php:
line 115: ' = ' . $last_alias . '.' . $relationship->getForeignKeyName();
line 126: $where = $this->tablePrefix . $first_model->getTable() . '.' . $first_relationship->getForeignKeyName() .
line 144: $fk = $nested['models'][0]->{$nested['pieces'][0]}()->getForeignKeyName();
-line 114: ' ON ' . $alias . '.' . $relationship->getOwnerKeyName() .