jjzjj

php - 未选中 Laravel Blade 复选框

我正在将变量从Controller传递到Blade中。这是我来自Controller的代码:$offerConditionsData=Offercondition::where('offerId',$id)->where('deleted','0')->get();returnview('Administrator.offers.add',$data);我在blade文件的顶部定义了一个变量:@if(isset($offerConditionsData))@foreach($offerConditionsDataas$offerConditions)@php$selectedCondC

php - 覆盖 laravel Blade 模板中的部分抛出 undefined variable 错误

我正在使用Laravel4和blade模板,但在尝试扩展模板时遇到了问题。在我的布局中有@yield('content')在我的页面中有@section('content')Welcome{{$name}}@stop效果很好,我创建了另一个与我的第一个非常相似的页面,只是想更改覆盖管理内容部分。模板中的其他部分没问题。所以我扩展我的页面,然后做@section('content')Hello!@stop我收到一个关于$name变量的未定义通知。我试过了@section('content')Hello!@overwrite同样,我收到通知错误。我检查了我的Controller,它使用了正

php - 无法将数据从 Controller 传递到 Blade 模板 laravel

在我的页面Controller中有$this->layout->content=View::make('authentication/login')->with('page_title','title');我正在为我的模板使用Blade文件。在html的头部,我有{{$page_title}}我得到一个错误,提示$page_title未定义。理想情况下,我想要的是$data=array('page_title'=>'Login','second_item'=>'value')...。但由于我无法将变量基本传递给View,所以我首先坚持这样做。 最佳答案

javascript - Laravel 4-重定向到 JavaScript 代码 Blade 模板中的路由

我正在尝试使用javascript和blade引擎编写一个简单的重定向,这是我想做的一个例子:javascript代码:ClickthebuttontogotothehomepageClickmefunctionmyFunction(){varx;varr=confirm("Areyousureyouwanttoleavethispage?");if(r==true){//Redirecttohome}else{//stayhere}document.getElementById("demo").innerHTML=x;}当我使用returnRedirect::route('home'

php - Laravel 中的@yield、@section

大家好,我想在master.blade.php中加载shopReq.blade.php文件,我成功地做到了这一点。但是当我在shopReq.blade.php中加载modals.blade.php文件时,它不包括在内。我在这里做错了什么吗?请帮忙。master.blade.php(在View/布局中):@yield('content')shopReq.blade.php(在View中)@extends('layouts.master')@section('content')HelloIaminshopReq.blade.php@yield(content)@endsectionmoda

php - 为什么我的变量在 Laravel 5.4 Blade 文件中显示不正确的值?

我有一个变量$country_code,它在我的表单的一部分显示正确的值,但在另一部分不显示。为什么会这样?这是我的代码:{{Form::open(['action'=>['PinVerificationController@valid'],'id'=>'pin_code_form'])}}//$country_codeshows1Wesentatextmessageto{{$country_code}}{{$phone_number}}.Youshouldreceiveitwithinafewseconds.{{Form::label('PinCode',null,['class'=

php - 如何将变量传递给@extends blade

我有变量{{$template}}..我该怎么做才能将该变量包含到@extends中。我试过这样的:@extends({{$template}})//gettingerror我希望,有一个答案可以帮助我。谢谢。 最佳答案 你的意思是你想将$template的值传递给你的布局?以及从哪里获得$template的值?如果你想将变量传递给layout,那么尝试做@extends('>',['template'=>$template]) 关于php-如何将变量传递给@extendsblade,我

php - 在 laravel View 中使用 carbon 函数(Blade 模板)

我从数据库中获取一些值,并将这些值传递到Controller的View中。现在我想在LaravelView中使用该数据和一些carbon函数。在我写的View文件中foreach($customeras$time){$create=$time->created_at;$update=$time->updated_at;$create_at_difference=\Carbon\Carbon::createFromTimestamp(strtotime($create))->diff(\Carbon\Carbon::now())->days;}当我这样尝试时,它返回"Class'Carb

php - 如何在 laravel blade 中获取唯一的小时和分钟?

我正在尝试在blade中获取小时、分钟和秒,通常我会像下面这样使用{{$calllog['delivery_date']}}但是现在我的要求是得到时分秒。这是我试图获得的方法$calllog['delivery_date']->todatestring()}}是的,我想我误用了这个功能,有人可以帮助我吗?我是Laravel的新手。任何帮助将不胜感激。 最佳答案 如果你的变量是DateTime,你可以使用这个:{{Carbon\Carbon::parse($calllog['delivery_date'])->format('H:i:

php - Laravel blade文件转word文档

我正在将数据从我的Controller传递到我的blade文件,然后想将blade文件导出到word文档,到目前为止一切都已控制,我可以将blade导出到word文档,问题是文档无法打开Microsoftword说“word在1.docx中发现不可读的内容”。下面是我正在使用的代码$view=View::make('advertisement.advt_template.template_dr')->with('advtData',$advtData->first())->render();$file_name=strtotime(date('Y-m-dH:i:s')).'_adver