blade

Laravel - Nested blade echos

让人想犯罪 __ 提交于 2019-12-11 05:34:03
问题 I am using a blade echo inside of a stylesheet reference in my header section. This is for specifying a CSS for a skin to the site. The original line is: <link href="{{ asset("/dist/css/skins/skin-default.min.css"}}" rel="stylesheet" type="text/css\" /> I am grabbing a skin setting per user and want to insert it into that line to change what the user wants as their skin. I have the setting pulled out into a variable from within a view service provider. $view->with('visualSkin', Auth::user()-

Variable undefined error in laravel blade view

爱⌒轻易说出口 提交于 2019-12-11 04:04:30
问题 Hey as i am passing a blade view which is having it own controller also i am including it into the view which does not have its own controller. it gives me an undefined variable error can any one help me how to it. I have a view which does not have any controller only have Route like this Route::get('index', function () { return view('index'); }); in this view i am passing another view which having its own controller and also having some data from an array. but after using this view inside

laravel Hash::make keep giving a different results

谁说胖子不能爱 提交于 2019-12-11 03:12:13
问题 I want to use the authentication in laravel 4 I changed the table's and mobel's name when the user register, I has the password and save it, the hash is : $password = Hash::make(Input::get('password')); and then when the user login I want ot authenticate him/her first. I do that like this: if (Auth::attempt(array('username' => Input::get('usernaem'), 'password' => Hash::make(Input::get('password'))))) { return Redirect::intended('dashboard'); } and that never success. I tried to debug the

Blade conditional extends

元气小坏坏 提交于 2019-12-11 02:12:34
问题 I know this seems like an answered question, but it is not (I hope). What I looking for is a way to extends or NOT a view: if the request is an ajax call the view does not extends nothing. Something like: @if(!Request::ajax()) @extends('navbar') @section('home') <div>"my content"</div> @stop @else <div>"my content"</div> @endif This is NOT what I looking for: @extends((( Request::ajax()) ? 'layouts.ajax' : 'layouts.default' )) I mean if the request is an ajax call, I want the view do not

Parse a string instead of a file for a Laravel Blade template

痞子三分冷 提交于 2019-12-10 20:59:18
问题 I need to cache a remote blade template generated by a CMS to keep an application's public interface up to date. Ideally I would be able to use file_get_contents and a cache to check for updates to this once a week. Is there any way to get Laravel to use the contents of a variable instead of a file as a blade template? 回答1: I could not find a way to get laravel to parse a string as a blade template so I developed this work around that stores the remote template as a local file.

Passing request parameter to View - Laravel

依然范特西╮ 提交于 2019-12-10 17:57:14
问题 Is it possible to pass a route parameter to a controller to then pass to a view in laravel ? Example; I have the route below; Route::get('post/{id}/{name}', 'BlogController@post')->name('blog-post'); I want to pass {id} and {name} to my view so in my controller class BlogController extends Controller { // public function post () { //get id and name and pass it to the view return view('pages.blog.post'); } } 回答1: You can use: public function post ($id, $name) { return view('pages.blog.post', [

How to pass variables by reference to @include in a blade template?

断了今生、忘了曾经 提交于 2019-12-10 17:22:44
问题 In a Laravel 4.2 setup, I have a variable in a template that I wish to share across multiple includes: master.blade <?php $tabindex = 0; ?>{{--This is the variable--}} @include('header'){{-- <-in header.blade, I often use ++$tabindex --}} {{--$tabindex is still 0--}} @include('content'){{-- <-in content.blade, I often use ++$tabindex --}} {{--$tabindex is still 0--}} @include('footer'){{-- <-in footer.blade, I often use ++$tabindex --}} {{--$tabindex is still 0--}} $tabindex if used as a

Laravel Blade @include .html files

我怕爱的太早我们不能终老 提交于 2019-12-10 15:42:53
问题 Include HTML files with blade Can I include a .html file in stead of .php with Laravel 4 Blade? My code: @include('emails.templates.file') //file is email.html file is automatically a .php file.. 回答1: While @PHPWeblineindia's solution worked for you, it's not really the Laravel way. However, you can do what you want by telling Laravel's view system to also consider .html files. By default it looks for .blade.php files, and then falls back to .php files. You can add .html to the searched

error Class “HTML” not found - Laravel 5.4

為{幸葍}努か 提交于 2019-12-10 15:41:59
问题 I am getting the following error: Class 'HTML' not found (View: C:\WORK\Software\XamppOne\htdocs\APOSTXUI\ContractorsClubField\resources\views\includes_header.blade.php) (View: C:\WORK\Software\XamppOne\htdocs\APOSTXUI\ContractorsClubField\resources\views\includes_header.blade.php) I have seen answers for 51., 5.2 and 5.3 - but - I have not seen anything for 5.4. This is what I got when I did the update: PS C:\WORK\Software\XamppOne\htdocs\APOSTXUI\ContractorsClubField> composer update

How to set disabled select option in Laravel?

霸气de小男生 提交于 2019-12-10 14:55:20
问题 In a controller function, I extract all the attributes and the attributes that I have already used. All the attributes: $attributeNames = array('' => 'Select Attribute Name') + AttributeName::lists('name' , 'id'); Already Taken Attributes: $selectedAttributeNames = $xmlDocument->masterInformation->masterAttributes; How can I make the selectedAttributeNames as disable please? Here is the output of var_dump($selectedAttributeNames) : object(Illuminate\ Database\ Eloquent\ Collection) #312 (1) {