TiagoSilvaPereira / vemto-issues

Repository to track Vemto Issues
30 stars 0 forks source link

Master Detail Errors - unexpected 'Plate' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST) #153

Closed snappyio closed 3 years ago

snappyio commented 3 years ago

Describe the bug On master detail pages the show (master) page does not show the detail records, the edit (master) page results in an error

ParseError syntax error, unexpected 'Plate' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST) (View: /Users/G/code/master_detail/resources/views/app/plates/edit.blade.php)

To Reproduce Create a very simple schema. Consisting of 3 models, users, plates, foods. The plate and food models have 1 field each (title).

A user hasMany plates, a plate hasMany foods.

screen129

Expected behaviour

No errors.

Screenshots

screen130

screen131

screen132

Desktop (please complete the following information):

Additional context Everything left at default to test the error other than disabling turbolinks.

TiagoSilvaPereira commented 3 years ago

Hi @graham-ch I needed to make a little adjustment on the Food model because Vemto generates the plural as 'foods', but Laravel considers the plural as 'food', so the migrations don't run. But after fixing it, the application is running well:

image

image

snappyio commented 3 years ago

Thanks Tiago.

FYI I had the same problem with another schema.

users, folders, videos

Would that be the same issue/fix do you think?

TiagoSilvaPereira commented 3 years ago

Hi @graham-ch I'll check with this other schema

snappyio commented 3 years ago

Thanks, it was exactly the same structure:

A user hasMany folders, a folder hasMany videos.

screen137

screen136

TiagoSilvaPereira commented 3 years ago

It worked without modifications :thinking:

I'll try to understand what is happening in your case.

image

TiagoSilvaPereira commented 3 years ago

@graham-ch what PHP version are you using?

snappyio commented 3 years ago

7.3.16

This appeared to fix:

Edit the app/Http/Livewire/FolderVideosDetail.php

Line 17/18, change:

public Folder $folder public Video $video

to

public $folder public $video

screen139

TiagoSilvaPereira commented 3 years ago

@graham-ch yes, the problem is the PHP version... the class property types were implemented on PHP 7.4... please upgrade your PHP and the problem will be gone.

Cheers