I tried to create a new blade directive in my AppServiceProvider: And then call this directive in my view: @test() But it’s not work and gives me a blank page. Answer i try several things but finally i fix this by copy and paste blade directive code from BladeCompiler.php to my custom directive instead of using compileString
Tag: laravel-blade
laravel 5.2 How to get route parameter in blade?
this is my url http://project.dev/blogs/image-with-article so, here I need the parameter image-with-article in my blade to display which is a parameter named slug here is in my routes file I need the slug paramter in blade. Answer I’m not sure what you mean. If you’re trying to construct the route in a Blade template, use If you’re trying to access
How to skip first item in a foreach loop in Laravel?
I am trying to fill my webpage with content based on content stored in a database. However, I would like to skip the first item; I want to start looping from the second item. How can I achieve this? Answer Try This :
Load Blade assets with https in Laravel
I am loading my css using this format: <link href=”{{ asset(‘assets/mdi/css/materialdesignicons.min.css’) }}” media=”all” rel=”stylesheet” type=”text/css” /> and it loads fine for all http requests But when I load my login page with SSL (https), I get a …page… was loaded over HTTPS, but requested an insecure stylesheet ‘http… Can someone please tell me how do I make blade load assets
Laravel blade “old input or default variable”?
I want to show the old input in input value. If there isn’t old input, than show other variable: But when there is no old input, it gives me 1 instead of the default value! I think the problem has something to do with the concatenation, but I don’t know how to fix it!? Answer or is a comparison operator
PHP code inside a Laravel 5 blade template
I have to place some PHP code inside a Laravel 5 blade template. Like below @foreach ($farmer->tasks as $task) @if ($task->pivot->due_at) < date(now)) $style = 'alert alert-...
How to Set Variables in a Laravel Blade Template
I’m reading the Laravel Blade documentation and I can’t figure out how to assign variables inside a template for use later. I can’t do {{ $old_section = “whatever” }} because that will echo “whatever” and I don’t want that. I understand that I can do <?php $old_section = “whatever”; ?>, but that’s not elegant. Is there a better, elegant way