Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8865331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T16:28:40+00:00 2026-06-14T16:28:40+00:00

Let say I have my user controller and there are action_index() , action_login() ,

  • 0

Let say I have my user controller and there are action_index(), action_login(), action_logout() action_profile($userid) methods in it. I want to make a routing that

www.mysite.com/user/xxxx

checks the xxxx part of the url and if it is not one of (login,logout,index) it calls action_profile(xxxx) method.

Now I am doing it like this:
my routing routs all www.mysite.com/user/xxxx type of requests to action_index and it checks whether xxxx is a method name or not. If it is not a method name it calls action_profile(xxxx)

However, I think it is possible in a better way. How can I do it better?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T16:28:43+00:00Added an answer on June 14, 2026 at 4:28 pm

    Hmm I’m not sure if I understand what you’re asking. Routes in laravel are on a first match basis.

    So you could just add the following to your routes.php:

    Route::get('user/(:num)', 'user@profile');
    Route::controller('user');
    

    The first line is for routing user/xxx to action_profile() in user controller where xxx is any numerical value. While the second will maps any other URI (user/***/***) to corresponding user controller’s methods. That means it automatically maps user/login to action_login(), user/register to action_register() and so on.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let say at my controller named Book , I have many methods, such as
Let's say I have User model and Post model. Post model contains field user_id
Let's say I have a user that entered 12 links into the database but
Let's say I have an user registration form. In this form, I have the
For instance, let's say I have a User model. Users have things like logins,
Let's say I have some models: User , Post , and Vote . A
Let's say I have two objects: User and Race. class User attr_accessor :first_name attr_accessor
I have a user control let say UC1 . This user control have viewmodel
Let's say I have two entities: Group and User. Every user can be member
Let's say I have a table that has user_id, date, score, and every user

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.