Load Blade assets with https in Laravel

I had a problem with asset function when it’s loaded resources through HTTP protocol when the website was using HTTPS, which is caused the “Mixed content” problem. To fix that you need to add \URL::forceScheme(‘https’) into your AppServiceProvider file. So mine looks like this (Laravel 5.4): <?php namespace App\Providers; use Illuminate\Support\ServiceProvider; class AppServiceProvider extends ServiceProvider … Read more

Passing data from controller to view in Laravel

Can you give this a try, return View::make(“user/regprofile”, compact(‘students’)); OR return View::make(“user/regprofile”)->with(array(‘students’=>$students)); While, you can set multiple variables something like this, $instructors=””; $instituitions=””; $compactData=array(‘students’, ‘instructors’, ‘instituitions’); $data=array(‘students’=>$students, ‘instructors’=>$instructors, ‘instituitions’=>$instituitions); return View::make(“user/regprofile”, compact($compactData)); return View::make(“user/regprofile”)->with($data);

What is the difference between {{ }} and {!! !!} in laravel blade files?

Blade {{ }} statements are automatically sent through PHP’s htmlentities function to prevent XSS attacks. If you pass data from your Controller to a View with some HTML styling like: $first = “<b>Narendra Sisodia</b>”; And it is accessed, within Blade, with {{ $first }} then the output’ll be: <b>Narendra Sisodia</b> But if it is accessed … Read more

How to Get the Current URL Inside @if Statement (Blade) in Laravel 4?

You can use: Request::url() to obtain the current URL, here is an example: @if(Request::url() === ‘your url here’) // code @endif Laravel offers a method to find out, whether the URL matches a pattern or not if (Request::is(‘admin/*’)) { // code } Check the related documentation to obtain different request information: http://laravel.com/docs/requests#request-information