mercredi 4 mai 2016

Laravel and vue js

This is my vue code: 
var vm = new Vue({
        el: '#userMgt',
        data: {
            name: 'tashi'
        },
        methods: {
            fetchUser: function () {
                this.$http.get('/api/users', function (data) {
                    console.log(events);
                    this.$set('users', data);
                });
            }
        },
        ready: function () {
            this.fetchUser();
        }


    });

And below is my route:

Route::resource('/api/users', 'userManagementController');

And this is my controller:

public function index()
    {
        $userRecords = AdminUser::LeftJoin('pltblusertype', 'tbluser.usUserTypeID', '=', 'pltblusertype.utID')
            ->select('tbluser.id', 'tbluser.usName', 'tbluser.email', 'pltblusertype.utName')
            ->get();

       return $userRecords;
    }

The error says: Request URL:http://localhost/api/users not found..basically it couldnot this.$http.get to /api/users i think...need help on this...



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1W8QjOY
via IFTTT

Aucun commentaire:

Enregistrer un commentaire