You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I am working on laravel project it has 2 tables in DB, one for "pages" and other for "notes" I am making 2 models n 2 controllers and I'm connecting the tables using one2many relation, "one page which has many notes". I made 2 views in blade files. one to show all the titles of all pages, I already have inserted title column in DB which refers to the title of page, on other table of notes, I used column of text, and i put another column as a foreign key called page id n i inserted the same value of the auto increment id in pages table, i post the functions in both models and from my experiment everything until nw is working fine, except the part of insertion of the note, it gives me errors, I believe the problem might be from route or notecontroller, I will post some codes down there:
The text was updated successfully, but these errors were encountered:
This is not an issue with this friendships package, but you're calling pages() on your Page model in your PostGeneralNote() method. You have a page() method on your Notes mode, or a note() method on your Page model.
public function postGeneralNote(Request $request, Page $page) {
$note = new Note;
$note->text = $request->get('note_text');
$note->save();
$page->note_id = $note->id;
$page->save();
return back();
}
I would spend a bit of time in the Laravel docs, and/or take a visit to laracasts. There are some great "getting started with Laravel" videos there that don't require a paid subscription.
Also, if you have further questions, I would use stackoverflow, or the laracasts forums. Github should be for issues with the individual packages.
Hi, I am working on laravel project it has 2 tables in DB, one for "pages" and other for "notes" I am making 2 models n 2 controllers and I'm connecting the tables using one2many relation, "one page which has many notes". I made 2 views in blade files. one to show all the titles of all pages, I already have inserted title column in DB which refers to the title of page, on other table of notes, I used column of text, and i put another column as a foreign key called page id n i inserted the same value of the auto increment id in pages table, i post the functions in both models and from my experiment everything until nw is working fine, except the part of insertion of the note, it gives me errors, I believe the problem might be from route or notecontroller, I will post some codes down there:
The text was updated successfully, but these errors were encountered: