How to force Laravel Project to use HTTPS for all routes?
Place this in the AppServiceProvider in the boot() method if($this->app->environment(‘production’)) { \URL::forceScheme(‘https’); }
Place this in the AppServiceProvider in the boot() method if($this->app->environment(‘production’)) { \URL::forceScheme(‘https’); }
Laravel 5.2 introduces the middleware groups concept: you can specify that one or more middleware belongs to a group, and you can apply a middleware group to one or more routes By default Laravel 5.2 defines a group named web, used to group the middleware handling session and other http utilities: protected $middlewareGroups = [ … Read more
Clearly not the ideal solution but it WORKS. I’ve added this to the top of my routes.php file: header(‘Access-Control-Allow-Origin: *’); header( ‘Access-Control-Allow-Headers: Authorization, Content-Type’ ); It would be nice to get this working without a hack… alas. UPDATE: It turned out to be IIS related. I ended up setting the headers in the web.config file … Read more
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
You should make sure that in app/Http/Kernel.php in middlewareGroups property for web you have: \Illuminate\View\Middleware\ShareErrorsFromSession::class, in this array. Compare this with https://github.com/laravel/laravel/blob/master/app/Http/Kernel.php EDIT It seems you need to add ‘middleware’ => ‘web’ for route you are using or put \Illuminate\View\Middleware\ShareErrorsFromSession::class, into $middleware property array or Inside of the routes.php file try to create your routes … Read more
Okay, after many hours of digging, the solution for my problem has been found. The reason why I say my problem is because the Exception is very mis-leading. Uncaught ReflectionException: Class log does not exist This exception simply means Laravel tried to log an error but couldn’t instantiate Laravel’s Log class. This is not due … Read more
This is a breaking problem with the 5.2 upgrade. What’s happening is the middleware which is responsible for making that errors variable available to all your views is not being utilized because it was moved from the global middleware to the web middleware group. There are two ways to fix this: In your kernel.php file, … Read more
I have installed php7, I did the following to solve exactly the same error sudo apt-get install php7.0-gd sudo apt-get install php7.0-intl sudo apt-get install php7.0-xsl
I’m assuming you added $this->middleware(‘auth’); inside the constructor of your controller to get the authentication working. In your login/register forms, if you are using {!! Form::someElement !!}, add the following line at the top as well: {!! csrf_field() !!} Or if you are using input tags inside your forms, just add the following line after … Read more
It is possible to protect images from public view in Laravel 5.x folder. Create images folder under storage folder (I have chosen storage folder because it has write permission already that I can use when I upload images to it) in Laravel like storage/app/images. Move the images you want to protect from public folder to … Read more