whitecube / nova-page

Static pages content management for Laravel Nova
https://whitecube.github.io/nova-page
MIT License
238 stars 41 forks source link

Issue with dots in routing name #16

Closed wimurk closed 5 years ago

wimurk commented 5 years ago

PSR

When running the command php artisan make:template AboutUs the package creates a template with the name About_us this conflicts with the rest of the laravel code (uppercase words) MyControllerHere.php

routing

Next when changed the template name to AboutUs and creating a route like :

Route::get('/about-us', 'Home\AboutUsController@index')->middleware('loadNovaPage')
    ->template(\App\Nova\Templates\AboutUs::class)
    ->name('about.us');

image

Looks like the dot is removed ?

Front

image

Don't know if i am missing something

voidgraphics commented 5 years ago

The class name is a bug. It definitely should be uppercase words.

I'm not sure what is causing the route to be cut at the dot, I will investigate and get back to you.

The last one is because the json file is missing from your system.

Thanks for bringing these to our attention.

wimurk commented 5 years ago

In the template command the line $name = ucfirst(snake_case($this->getNameArgument())); change to $name = ucwords($this->getNameArgument());

wimurk commented 5 years ago

I fixed the issue with the dot in https://github.com/whitecube/nova-page/pull/17 The problem was the explode on the name for the type and key variable.

Changing it to explode only on the first dot, fixes the issue