DEV Community

Md Abdullah al noor
Md Abdullah al noor

Posted on

How will I identify resource default url in laravel?

I am running this command for model, migration, resource controller.

php artisan make:model QuestionAnswer -mc -r ..
My Edit Function

public function edit(QuestionAnswer $questionAnswer)
{
// return $questionAnswer;
return view('backend.faq.edit',get_defined_vars());
}

Route one in web.php : Route::resource('faq','QuestionAnswerController'); in view : {{route('admin.faq.edit',$questionAnswer->id)}}

Route two in web.php : Route::resource('question-answer','QuestionAnswerController'); in view {{route('admin.question-answer.edit',$questionAnswer->id)}}

in Edit function for Route one : $questionAnswer object return null. but for Route two : $questionAnswer return object mean expected output ..

Follow this question

Question is there possible way to find out what exact url I will write ? .. like question-answer.. or command line ...or how will I figure it out ? I think there must be something..

How will I know I need to write question-answer this ? by default it works... when i write faq i need to change in edit function variable($faq) .

How will I know by default url (question-answer) will work ..when php artisan route:list command give us all route list.. and when I make model Category laravel create table name categories and follow grammar rules

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (1)

Collapse
 
abdullahalnoor profile image
Md Abdullah al noor • Edited

After running auth command I find all route list … route:list by this command..
But after running this command php artisan make:model QuestionAnswer -mc -r I did not find QuestionAnswer model route list …
if i write in web.php this line Route::resource('question-answer','QuestionAnswerController'); everythink is okay but if I write in web.php : Route::resource('faq','QuestionAnswerController'); i need to change in edit function variable($faq) .

How will I know I need to write Route::resource('question-answer','QuestionAnswerController'); ?
how i will identify resource default url in laravel ?

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay