我正在编写一个Web应用程序.后端是一个基于Laravel 4的RESTFul应用程序.
我遇到了特定控制器的问题.
BedsController.php
class BedsController extends \BaseController {
/**
* Display a listing of the resource.
* GET /beds
*
* @return Response
*/
public function index()
{
//
$user = JWTAuth::parseToken()->authenticate();
$data = Input::get('room');
$retorno = array();
$hoy = date('Y-m-d');
if( $data ){
$d = intval( $data );
$beds = Bed::where('room', '=', $d )->get( array('size', 'room', 'id', 'name') );
foreach( $beds as $b ){
$b->stay = Stay::where('bed', '=', $b->id )
->where('indate', '<=', $hoy )
->where('outdate', '>=', $hoy ) …Run Code Online (Sandbox Code Playgroud) 在使用IE11时,作品的客户在我们的应用程序中报告了一个问题.
在某个特定表单上,有时,打开它时,如果键入,键入的文本将不会显示.如果我打开开发者工具,它会突然显示出来.
这是属于该表单的呈现的html:
<div class="col-sm-6 ">
<div class="form-group" data-ng-show="myform.txtPropietario.visible">
<label class="col-md-4 control-label my-show-hide-animation">Propietario:</label>
<div class="col-md-8">
<div class=" ">
<input name="txtPropietario" class="form-control text-left ng-pristine ng-valid" input-alpha-numeric="ES" onblur="this.value=this.value.toUpperCase();" data-ng-model="myform.values.txtPropietario" data-ng-disabled="myform.txtPropietario.disabled" type="text" step="0.01" maxlength="50" placeholder=" "></div>
<ul class="errores my-show-hide-animation ng-hide" data-ng-show="myform.seccionPanelPagoServiciosname.txtPropietario.$invalid && myform.procesado"><li data-ng-show="myform.seccionPanelPagoServiciosname.txtPropietario.$error.required" class="ng-hide"><span>Campo obligatorio</span></li><li data-ng-show="myform.seccionPanelPagoServiciosname.txtPropietario.$error.pattern" class="ng-hide"><span>El formato del dato ingresado no es válido.</span></li>
</ul>
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
关于AngularJs和html的应用程序工作是在Bootstrap 3上构建的.任何想法为什么会发生这种情况?
伙计,我有一个问题是将记录保存到数据库中.正如我理解错误,它似乎不存在表中的'id_purchase'.但确实如此.我正在使用的代码如下:
<?php
class Purchproducts_Controller extends Base_Controller {
public $restful = true;
public function get_index()
{
$purchases = Purchproduct::where('id_hostel', '=', Session::get('id_hostel'))->get();
$response = array();
foreach($purchases as $purch){
$response[] = $purch->attributes;
}
return json_encode($response);
}
public function post_create()
{
$data = Input::json();
$purchase = Purchproduct::create(
array(
'id_hostel' => Session::get('id_hostel'),
'id_products' => $data->id_products,
'id_purchase,' => $data->id_purchases,
'qty' => $data->qty
)
);
return json_encode($purchase->attributes);
}
}
Run Code Online (Sandbox Code Playgroud)
错误屏幕:
Unhandled Exception
Message:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'id_purchase,' in 'field list'
SQL: INSERT INTO …Run Code Online (Sandbox Code Playgroud) 我收到这个错误:
call_user_func_array() expects parameter 1 to be a valid callback, class 'Symfony\Component\HttpFoundation\LaravelRequest' does not have a method 'url'
Run Code Online (Sandbox Code Playgroud)
我正在使用的代码是:
routes.php文件:
<?php
Route::post('', 'app@check');
Route::get('', 'app@check');
Route::post('game', 'app@game');
Route::get('game', 'app@game');
Route::get('terminos', 'app@terminos');
Route::post('save', 'scores@savescore');
Route::get('scores', 'scores@scorelist');
Route::get('scores2468', 'scores@showscores');
Event::listen('404', function()
{
//return Response::error('404');
echo "Error 404: \n";
echo Request::url();
});
Event::listen('500', function()
{
return Response::error('500');
});
Route::filter('before', function()
{
// Do stuff before every request to your application...
});
Route::filter('after', function($response)
{
// Do stuff after every request to your application... …Run Code Online (Sandbox Code Playgroud) 伙伴们,我试着在点击单选按钮时设置骨干事件.我有以下按钮:
<p><label for="pays">Pays now</label><input id="pays" name="pays" type="radio" value="1" class="_100"/></p>
<p><label for="pays2">Pays later</label><input id="pays2" name="pays" type="radio" value="2" class="_100"/>
Run Code Online (Sandbox Code Playgroud)
我定义了这样的事件:
'click input[name=pays]:not(:checked)': 'radioChecked'
Run Code Online (Sandbox Code Playgroud)
因此,据我所知,当点击未选中的名为pays的输入时,它应该触发.
问题是,当我点击单选按钮时,没有触发任何事件.
如果我试试这个......
'click input[name=pays]': radioClicked
Run Code Online (Sandbox Code Playgroud)
我可以用一些标志修复此问题,但每次点击任何无线电时我都会触发该事件.
任何的想法?谢谢!
伙计,我有这个代码:
var newCustomer = customers.create({
'id_pais' : usrinfo.country,
'nombre' : usrinfo.name,
'apellido' : usrinfo.lastname,
'pasaporte' : usrinfo.passport,
'mail' : usrinfo.mail,
'birth' : usrinfo.birth
});
console.log(newCustomer.get('id'));
// Create Guest
var cama = beds.get(usrinfo.dorm);
var newGuest = guests.create({
'id_room' : cama.get('id_room'),
'id_bed' : usrinfo.dorm,
'id_customer' : newCustomer.get('id'),
'inDate' : usrinfo.inDate,
'outDate' : usrinfo.outDate,
'notas' : usrinfo.notes
});
Run Code Online (Sandbox Code Playgroud)
问题是,我需要获得newCustomer的RESTFul给定id,但是不知道任何方法要等到从服务器回答post请求.有任何想法吗?
谢谢!
更新:
我这样做了:
var newCustomer;
newCustomer = customers.create({
'id_pais' : usrinfo.country,
'nombre' : usrinfo.name,
'apellido' : usrinfo.lastname,
'pasaporte' : usrinfo.passport,
'mail' : usrinfo.mail,
'birth' …Run Code Online (Sandbox Code Playgroud) Mates,我正在开发Backbone/Laravel应用程序.当我尝试向某个资源发送POST请求时,它返回301状态且没有响应,无论在控制器上我是否正在打印"hello world",以检查它是否已到达该点.
这是一些代码......
public function store()
{
//
return 'hello world';
}
Run Code Online (Sandbox Code Playgroud)
这是routes.php
Route::group(array('before' => 'auth'), function()
{
Route::get('/', 'SitesController@index');
Route::resource('rooms', 'RoomsController');
});
Run Code Online (Sandbox Code Playgroud)
所以,当我发出POST请求时
rooms
Run Code Online (Sandbox Code Playgroud)
有了一些保存的信息,它会让我回到301状态,完全没有响应.
知道我做错了什么吗?
提前致谢!
伙计,我有一个客人收藏.每位客人都有一个inDate,一个outDate和正在占用的床的id_beds.我试图过滤所有客人同时满足以下声明:
inDate> == date
App.Collections.Guests = Backbone.Collection.extend({
url: 'guests/',
model: App.Models.Guest,
getBooking: function(bed, date){
var gf = _.filter(this.models, function(model){
// Get all Guests with id_beds = bed
// && outDate < date && inDate <= date
});
console.log(gf);
return gf;
}
});
Run Code Online (Sandbox Code Playgroud)现在,问题是,我不知道如何使用这3个语句过滤掉集合.首先,不知道如何比较日期,因为它们是字符串,不能看到比其他日期更大.第二,不知道如何使用多于1个参数进行过滤.
有任何想法吗?
谢谢!
backbone.js ×4
laravel ×3
php ×3
jquery ×2
laravel-3 ×2
laravel-4 ×2
bootstrap-4 ×1
javascript ×1