Defining Eloquent model (will assume that DB table named is set as plural of class name and primary key named "id"):
class Shop extends Eloquent {}
Using custom table name
protected $table = 'my_shops';
(function(){ | |
'use strict'; | |
angular | |
.module('ARM') | |
.factory('LoansFactory', LoansFactory); | |
LoansFactory.$inject = ['$http', '$q', 'API_URL', 'AppFactory']; | |
/* @ngInject */ | |
function LoansFactory($http, $q, API_URL, AppFactory) { |
$scope.insertFarmer = function() { | |
if($scope.farmer && $scope.farmer.id){ | |
$http.put('/api/farmers/' + $scope.farmer.id, $scope.farmer) | |
.success(function(data,status){ | |
console.log('Record Updated!'); | |
}) | |
.error(function(data, status){ | |
$scope.data = data || "Request failed"; | |
$scope.status = status; | |
}); |
<!--I am consuming an API feed and want to repeat a table row for each crop returned. I am doing something wrong.--> | |
<!-- here is the html that should print a single row of data --> | |
<table class="table striped-table"> | |
<tr> | |
<th style="width:20%;text-align:left;">Crop</th> | |
<th style="width:10%;">{{globals[0].g_crop_year -1}}</th> | |
<th style="width:10%;">{{globals[0].g_crop_year -2}}</th> | |
<th style="width:10%;">{{globals[0].g_crop_year -3}}</th> | |
<th style="width:10%;">3yr Average</th> |
(function(){ | |
$(document).ready(function(){ | |
$('.flashmsg').delay(3000).fadeOut(300); | |
//alert($('#user_id').data('id')); | |
}); | |
var ARM = angular.module('ARM', [ | |
'ui.router', 'ui.bootstrap', 'ui.utils', 'ngSanitize', 'ui.select', 'multi-select' | |
]); |
(function(){ | |
$(document).ready(function(){ | |
$('.flashmsg').delay(3000).fadeOut(300); | |
//alert($('#user_id').data('id')); | |
}); | |
var ARM = angular.module('ARM', [ | |
'ui.router', 'ui.bootstrap', 'ui.utils', 'ngSanitize', 'ui.select', 'multi-select' | |
]); |
(function(){ | |
var EditAppController = function($scope, $state, $http, $location, $window, _){ //, loan | |
}; // end EditAppController | |
EditAppController.$inject = ['$scope', '$filter', '$state', '$http', '$location', '$window', '_']; //, 'loan' | |
angular.module('ARM').controller('EditAppController', EditAppController); | |
}()); |
[ChildScope, function, Object, function, LocationHashbangUrl, Window, function]0: ChildScope1: function (name) {2: Object3: function $http(requestConfig) {4: LocationHashbangUrl5: Window6: function J(n){return n&&typeof n=="object"&&!Te(n)&&me.call(n,"__wrapped__")?n:new Q(n)callee: function ($scope, $state, $http, $location, $window, _){ //, loanlength: 7__proto__: Object |
angular.module('LoanManager',function(LoansFactory){ | |
function updateLoansData(response){ | |
var allLoans = response.data.data; | |
return $q.all(allLoans.map(updateLoanData)); | |
} | |
function updateLoanData(loan){ | |
return $q.all({ | |
need_vote: getPendingVotes(loan), |
return LoansFactory.getLoan($stateParams.loanID) | |
.then(function(data) { | |
console.log(data); | |
return data; | |
}); | |
Object {data: Object, status: 200, headers: function, config: Object, statusText: "OK"}config: Objectcached: falseheaders: Objectmethod: "GET"transformRequest: Array[1]transformResponse: Array[1]url: "http://www.lenda.local:6500/api/loans/10"__proto__: Objectdata: Objectdata: Objectaccount_classification: 0added_land: falseadded_land_verified: 0analyst: Objectaoi_received: 0app_date: "01/05/2015"applicant: nullapplicant_id: nullarm_approved: 0arm_balance: 0arm_ucc_received: 0attachments: falsebankruptcy_history: falsebankruptcy_order_received: 0ccc_received: 0comments: Array[0]committee: Array[0]conditions: Objectcontrolled_disbursement: falsecorporations: Array[0]crop_inspection: 0crop_year: "2015"crops: Array[8]decision_date: nulldist_approved: 0dist_ucc_received: 0distributor: nulldistributor_id: nulldue_date: "12/15/2015"entity_type: nullentity_type_id: nullfarmer: nullfarmer_id: 0fins: Objec |