blade

How can I put multiple classes in a <li> element?

允我心安 提交于 2019-12-13 19:20:14
问题 I am working with a navigation menu, and wondering how to put multiple classes in a li tag: This is the li tag <li class='pil' class='dropdown'> And this is also what I want in the li tag: class='{{ ($aktiv == 'dagvakt') ? 'active' : '' }}' I tried this and it didn't work: <li class='pil' class='dropdown' class='{{ ($aktiv == 'dagvakt') ? 'active' : '' }}'> 回答1: You can add multiple classes to an element by putting them all in the same class attribute and separating them with a space. For

link to specific anchor on a page with Laravel

[亡魂溺海] 提交于 2019-12-13 14:08:41
问题 How does one go about linking to a specific id in a view with Laravel? My controller: public function services() { return View::make('services.custom_paint', array('pageTitle' => 'Custom Paint'))->with('default_title', $this->default_title); } My route: Route::get('/custom_paint', 'PagesController@services'); I have tried to add #id to the route, to the controller, and even to the view's URL::to . Nothing seems to work. I assumed that simply adding the id on to the URI would do the trick, but

Laravel 4: if statement in blade layout works strange

安稳与你 提交于 2019-12-13 13:08:27
问题 Could someone explain me why I get blank screen with printed string "@extends('layouts.default')" if I request page normally (not ajax)? @if(!Request::ajax()) @extends('layouts.default') @section('content') @endif Test @if(!Request::ajax()) @stop @endif I'm trying to solve problem with Ajax, I don't want to create 2 templates for each request type and also I do want to use blade templates, so using controller layouts doesn't work for me. How can I do it in blade template? I was looking at

Form error htmlentities() expects parameter 1 to be string, array given and no line

余生长醉 提交于 2019-12-13 08:17:44
问题 If I change the error to simple HTML, the error is gone. {{Form::open(array('url'=>'')) . "" }} <div class="basic-form"> and it goes on: (cannot paste more code here) <div class="hsb-input-1"> {{Form::text('user_query', array('class'=>'form-control', 'placeholder'=>'I\'m looking for qualified personnel in ...')) }} </div> <div class="hsb-text-1">Language</div> <div class="hsb-container"> <div class="hsb-select"> {{Form::select('selection', ['all'=> 'Select all', 'c' => 'C/C++/C#', 'html' =>

Database json column returning escaped string in laravel blade

╄→尐↘猪︶ㄣ 提交于 2019-12-13 06:37:15
问题 I have saved some Json data in a MySQL column. While fetching the data to a Laravel Blade application the json fields are all escaped. Hence, I am facing issues while reading the json data. [ { "id": "1", "json_backup": "{\"id\":\"2\",\"organization_id\":\"1\",\"amount\":\"7800.00\",\"date\":\"2015-05-11\",\"created_at\":\"2015-05-11 07:20:45\",\"updated_at\":\"2015-05-11 07:20:45\"}", "ip": "127.0.0.1", "created_at": "2015-05-12 12:21:16", "updated_at": "2015-05-12 12:21:16" } ] The json

Formatting request URL in Laravel Blade

雨燕双飞 提交于 2019-12-13 06:11:10
问题 I have been searching for long time to make work using prettus/l5-repository but none of things that I tried worked. My problem is that I need to format get request url like ?search=name:John Doe;email:john@gmail.com when user click submit button. I have tried to replace request()->query->all() to "search"=>"name:John Doe;email:john@gmail.com" but it did not work. I believe request's GET URL should be that format. How to format request URL like that? Controller index() $paginator = $this-

Cannot end a section without first starting one in Laravel

一世执手 提交于 2019-12-12 20:01:12
问题 @extends('main') @foreach ($hotel as $hotel) @foreach ($city as $city) @section('title'," $hotel->hotel - $city->city") @endsection @section('content') {{-- Header --}} <div style="background-image:url('../img/{{ $hotel->id }}.jpg'); height:400px; background-size:cover;"> <div class="container"> @include('partials._nav') <div class="row"> <center> <h2> <div class="col-md-12 hotel-name"> {{ $hotel->hotel }} <p class="city"> </h2> {{ $city->city }} @endforeach </p> </div> </center> </div> </div

unexpected endforeach in blade template

岁酱吖の 提交于 2019-12-12 15:12:18
问题 I have a blade template in laravel in laravel that displays a tab view. The tabs are different eventtypes and in the tabs are the events per type. This view worked fine until today. The only thing that changed is that I made it possible to soft-delete events . The error I get is the following: syntax error, unexpected 'endforeach' (T_ENDFOREACH) This is the entire source code of the template: @extends('master') @section('title', '- Kalenderbeheer') @section('head') {{ HTML::script('Script/lib

Laravel 5.0 blade template and count() conditions

纵然是瞬间 提交于 2019-12-12 12:25:29
问题 I've a collection (tasks) and I want to count inside may blade template only completed tasks. Ex. Total tasks = 7 Total completed tasks = 2 Total in progress tasks = 5 I try {{ count($tasks->completed = 100) }} And it works, but if I try {{ count($tasks->completed < 100) }} I got an error. Any help? Sorry, I'm a newbie on laravel. (laravel 5.0) UPDATE I need to show something like: Completed (2) / in progress (5). In my controller I've: public function index() { $tasks = Task::All();

Laravel 4 - Multiple forms on same page?

北慕城南 提交于 2019-12-12 11:02:10
问题 I'm having some strange behavior with my forms in Laravel 4. I have a "settings" page with two forms, each (are supposed to) POST to a controller method, update the database and return back to the settings page. However, there seems to be an issue, either with the way my forms are working or my routes. Here's how it is, simplified: Settings page: (site.com/settings) <div id="form-one" class="form-area"> {{ Form::open(array('action' => 'SettingController@editOption')) }} {{ Form::text(