themosis / framework

The Themosis framework core.
https://framework.themosis.com/
GNU General Public License v2.0
671 stars 121 forks source link

Route problems #341

Closed kevinkiel closed 8 years ago

kevinkiel commented 8 years ago

I'm currently using "themosis/framework": "dev-master" When I'm trying to access my custom post type route it skips all singular routes except the last one.

Do i do something wrong?

This is my routing file: ` /* * Posttype: Acties / Route::get('singular', [ACTIE_POST_TYPE, 'uses' => 'ActieController@singular']); Route::get('postTypeArchive', [ACTIE_POST_TYPE, 'uses' => 'ActieController@archive']);

/**
 * Posttype: Location
 */
Route::get('singular', [LOCATION_POST_TYPE, 'uses' => 'LocationController@singular']);

/**
 * Route for the default singular page
 */
Route::any('singular', 'PageController@singular');

`

dstollie commented 8 years ago

Pull request https://github.com/themosis/framework/pull/343 fixes this

jlambe commented 8 years ago

Before looking after the PR, are your custom post types public and have you set a custom public query var name? I find this strange to not work as we have 2 production projects with multiple custom post types and the routing is working as expected.

kevinkiel commented 8 years ago

The custom post types are almost default:

And there is no custom logic added.

` 'actie' => [ 'plural_name' => "Acties", 'singular_name' => "Actie", 'supports' => ['title', 'editor', 'thumbnail'], 'menu_icon' => 'dashicons-awards', ],

'locatie' => [
    'plural_name'   => "Locaties",
    'singular_name' => "Locatie",
    'supports'      => ['title', 'editor', 'thumbnail'],
    'menu_icon'     => 'dashicons-location-alt',
]

`

jlambe commented 8 years ago

The default arguments for the custom post type do not set it as public. Can you add the public argument and set it to true and let us know what's going on?

kevinkiel commented 8 years ago

@jlambe Is makes unfortunately no difference. Still the same issue :(

jlambe commented 8 years ago

Can you post your full code regarding the registration of your custom post types and the routes for reference so we can test this?

kevinkiel commented 8 years ago

Constants.config.php:

'PAGE_POST_TYPE' => 'page', 'ACTIE_POST_TYPE' => 'actie', 'LOCATION_POST_TYPE' => 'location',

Post-types.config.php: ` return [

ACTIE_POST_TYPE => [
    'plural_name'   => "Acties",
    'public'        => true,
    'singular_name' => "Actie",
    'supports'      => ['title', 'editor', 'thumbnail'],
    'menu_icon'     => 'dashicons-awards',
],

LOCATION_POST_TYPE => [
    'plural_name'   => "Locaties",
    'public'        => true,
    'singular_name' => "Locatie",
    'supports'      => ['title', 'editor', 'thumbnail'],
    'menu_icon'     => 'dashicons-location-alt',
]

]; `

Routes.php: ` Route::get('cms', function () { // Check if you're logged in if (is_user_logged_in()) { // If so go to the wp dashboard return header('Location: /cms/wp-admin'); } // Otherwise go to the login form return header('Location: /cms/wp-login.php'); });

Route::group(['namespace' => 'App\Controllers'], function() {

/**
 * Route for the default page
 */
Route::get('front', 'PageController@front');

/**
 * Posttype: Acties
 */
Route::get('singular', [ACTIE_POST_TYPE, 'uses' => 'ActieController@singular']);
Route::get('postTypeArchive', [ACTIE_POST_TYPE, 'uses' => 'ActieController@archive']);

/**
 * Posttype: Location
 */
Route::get('singular', [LOCATION_POST_TYPE, 'uses' => 'LocationController@singular']);

/**
 * Route for the default singular page
 */
Route::any('singular', 'PageController@singular');

/**
 * Route for the slide page template page
 */
Route::get('search', 'PostController@search');

/**
 * Route for the default archive page
 */
Route::get('archive', 'ExampleController@archive');

/**
 * Route for the 404 not found page
 */
Route::get('404', 'PageController@notFound');

}); `

kevinkiel commented 8 years ago

@jlambe The PR from dstollie fixes my problems.

jlambe commented 8 years ago

Cool, it's good to know, will test it all.

jlambe commented 8 years ago

@kevinkiel I've updated the routing and fix an omit from @dstollie PR. Can you update to latest dev-master commit and let us know if everything works as expected? Thanks

jlambe commented 8 years ago

@kevinkiel Can you pull the latest version of the framework as well as checking that you have version 5.3 of illuminate packages on your project and let me know if everything works correctly?

kevinkiel commented 8 years ago

@jlambe When I do composer update I'm getting 404 error's for every routing. (It's not working with illuminate 5.3)

jlambe commented 8 years ago

@kevinkiel Can you share your project so I can clone it and test it?

dstollie commented 8 years ago

This issue can be closed. Ive talked with kevinkiel and he told me it was fixed.

jlambe commented 8 years ago

👍 Cool thanks