Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4829

Post Will Not Persist to Database

$
0
0

@tjnine wrote:

What's up ya'll. I knew if anyone would have an answer or help it would be here. I am using a PHP framework called Laravel as an API and I am having some troubles getting Ember to persist the form post. The form data saves and can be seen in my other route but not in the database, and disappears after refreshing the page. Here is my route - I'll post my Laravel controller too in case there any Laravel experts here too but I really think the issue is with Ember because I can persist the post when I use the same route using just laravel.

    //ember route
    model() {
        return this.store.createRecord('library');
    },


 actions: {
    saveLibrary() {
        this.get('model').save().then(() => this.transitionToRoute('libraries'));
    },
    willTransition() {
        this.get('model').rollbackAttributes();
    }
}

     //laravel controller
        $statusCode = 200;
        $libraries = $request->all();
        $library = Library::create($libraries);
        $criteria = $library->toArray();
        return Response::json([
            'libraries' => $criteria],
             $statusCode);

Posts: 9

Participants: 4

Read full topic


Viewing all articles
Browse latest Browse all 4829

Trending Articles