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
Top comments (1)
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 findQuestionAnswer
model route list …if i write in
web.php
this lineRoute::resource('question-answer','QuestionAnswerController');
everythink is okay but if I write inweb.php
:Route::resource('faq','QuestionAnswerController');
i need to change inedit 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 ?