You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Laravel Nova 1.0.5 with fresh install of latest Laravel 5.6.
A Nova Date field dob on a User resource works properly when viewing/editing the User resource directly, but not when displaying that resource as a related resource through a parent resource (Company).
Again, this only happens when viewing the Company resource when it tries to show the related User resource.
Here's the setup:
Given the following db tables:
companies table
column
datatype
length
id
int
10
name
varchar
255
users table
column
datatype
length
id
int
10
name
varchar
255
email
varchar
255
password
varchar
255
dob
date
company_id
int
10
created_at
timestamp
udpated_at
timestamp
Eloquent Models App\Company.php
class Company extends Model
{
/**
* Get the users for this company
*/
public function users()
{
return $this->hasMany(User::class, 'company_id', 'id');
}
}
App\User.php
class User extends Authenticatable
{
use Notifiable;
/* Removed for brevity... */
/**
* Get company for this user
*/
public function company()
{
return $this->belongsTo(Company::class);
}
}
Nova Resources App\Nova\Company.php
class Company extends Resource
{
/* Removed for brevity... */
/**
* Get the fields displayed by the resource.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function fields(Request $request)
{
return [
ID::make()->sortable(),
Text::make('Name')
->sortable()
->rules('required', 'max:255'),
HasMany::make('Users'),
];
}
}
App\Nova\User.php
class User extends Resource
{
/* Removed for brevity... */
/**
* Get the fields displayed by the resource.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function fields(Request $request)
{
return [
ID::make()->sortable(),
Text::make('Name')
->sortable()
->rules('required', 'max:255'),
Date::make('dob')
->sortable(),
BelongsTo::make('Company'),
];
}
}
The text was updated successfully, but these errors were encountered:
Laravel Nova 1.0.5 with fresh install of latest Laravel 5.6.
A Nova
Date
field dob on aUser
resource works properly when viewing/editing theUser
resource directly, but not when displaying that resource as a related resource through a parent resource (Company
).Screenshot of front-end error showing the related resource: http://ander.ly/WNsUuZ
Screenshot of the network call that's failing: http://ander.ly/WTye9w
Again, this only happens when viewing the
Company
resource when it tries to show the relatedUser
resource.Here's the setup:
Given the following db tables:
companies table
users table
Eloquent Models
App\Company.php
App\User.php
Nova Resources
App\Nova\Company.php
App\Nova\User.php
The text was updated successfully, but these errors were encountered: