我想在视图上使用Carbon我将它包含在视图文件的顶部但它不起作用,我这样做.
<?php use carbon/carbon;?>
@extends('main_layout')
@foreach ($myquery as $mytask)
<tr>
<td >
{{($mytask->firstname)}}
</td>
<td >
{{($mytask->lastname)}}
</td>
<td>
{{($mytask->logon)}}
</td>
@section('content')
@stop
Run Code Online (Sandbox Code Playgroud)
我只是得到错误.我想使用carbon将{{($ mytask-> logon)}}转换为人类可读的格式
在这里我很难找到需要ID和匹配日期的特定记录,这是我的代码:
$testq= DB::table('attendances')->where('user_id', '=', $userinput && 'logon', '=', $newdate)->get();
Run Code Online (Sandbox Code Playgroud) 所以我现在正在使用我的程序的更新部分,现在我想用我的数据库中的旧记录填充我的表单来编辑它.现在我的问题是单选按钮,如何选择真正的单选按钮.我试过这个代码,我在单选按钮上使用if
{{ Form::label('Type','Type')}}
{{ Form::radio('ctype', '1',if(($item->bname)==1){true}) }}
{{ Form::label('Rooster','Rooster')}}
{{ Form::radio('ctype', '0') }}
{{ Form::label('Hen','Hen')}}
Run Code Online (Sandbox Code Playgroud)
但我得到错误500,请帮忙
在这方面工作了几个小时,我想在视图中打印控制器变量。这是我的代码:
控制器:
$mydate=Carbon::now()->addHours(8);
$newdate=$mydate->toDateString();
$mydata = DB::table('attendances')->where('date_only', '=', $newdate)->get();
return View::make('Home')->with($mydata);
Run Code Online (Sandbox Code Playgroud)
这是我的观点
<div> {{$mydata}} </div>
Run Code Online (Sandbox Code Playgroud)
我只是收到此代码的错误