laravel-5.2

How to protect image from public view in Laravel 5?

本小妞迷上赌 提交于 2019-11-26 12:26:16
I have installed Laravel 5.0 and have made Authentication. Everything is working just fine. My web site is only open for Authenticated members. The content inside is protected to Authenticated members only, but the images inside the site is not protected for public view. Any one writes the image URL directly can see the image, even if the person is not logged in to the system. http://www.somedomainname.net/images/users/userImage.jpg My Question: is it possible to protect images (the above URL example) from public view, in other Word if a URL of the image send to any person, the individual must

Laravel 5.2 validation errors

一笑奈何 提交于 2019-11-26 11:09:40
问题 I have some trouble with validation in Laravel 5.2 When i try validate request in controller like this $this->validate($request, [ \'title\' => \'required\', \'content.*.rate\' => \'required\', ]); Validator catch error, but don\'t store them to session, so when i\'m try to call in template this code @if (isset($errors) && count($errors) > 0) <div class=\"alert alert-danger\"> <ul> @foreach ($errors->all() as $error) <li>{{ $error }}</li> @endforeach </ul> </div> @endif Laravel throw the

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

我们两清 提交于 2019-11-26 09:44:01
问题 In the laravel framework we can use blade to add PHP code in html file. We are using both {{ }} and {!! !!} syntax in blade files of Laravel. What is the difference between them? 回答1: 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

Laravel 5.2 not reading env file

旧城冷巷雨未停 提交于 2019-11-26 09:19:15
问题 After upgrading to Laravel 5.2, none of my .env file values are being read. I followed the upgrade instructions; none of my config files were changed except auth.php. They were all working fine in previous version, 5.1.19 .env contains values such as DB_DATABASE=mydb DB_USERNAME=myuser config/database.php contains \'mysql\' => [ \'database\' => env(\'DB_DATABASE\', \'forge\'), \'username\' => env(\'DB_USERNAME\', \'forge\'), ] I get this error: PDOException: SQLSTATE[HY000] [1045] Access

Undefined variable: errors in Laravel

独自空忆成欢 提交于 2019-11-26 09:09:36
问题 When I want to register a user in my laravel project, the page always says Undefined variable: errors (View: /var/www/resources/views/auth/register.blade.php)\" According to the Laravel documentation, $errors should always automatically be set: So, it is important to note that an $errors variable will always be available in all of your views on every request, allowing you to conveniently assume the $errors variable is always defined and can be safely used. I have this on on every view when I

Laravel 5.2 $errors not appearing in Blade

爷,独闯天下 提交于 2019-11-26 06:07:06
问题 So I\'m following along with the Laravel 5 fundamentals tutorial and I am stuck on the form validation. I have followed along exactly with the tutorial but I am getting a Undefined variable: errors in my create articles view. In the tutorial I am following and what I have found online they say the errors variable is always there in the blade file for you to use so I don\'t know what i am doing wrong? Any help would be appreciated! loving Laravel except for this error! View @if($errors->any())

TokenMismatchException in VerifyCsrfToken.php Line 67

有些话、适合烂在心里 提交于 2019-11-26 03:30:31
问题 I know that this is a known error with things like forms in Laravel. But I am facing an issue with basic authentication in Laravel 5.2. I created the auth using Laravel; php artisan make:auth Now I have the same copy of code on my server and my local. On my local I am getting no issue whatsoever. However on my server, when I try to register a user I get the error saying TokenMismatchException in VerifyCsrfToken.php Line 67 Both my local and server environments are in sync, yet I keep getting

Laravel 5.2 Validation Error not appearing in blade

假如想象 提交于 2019-11-26 03:18:58
问题 I want to show validation Error in View page while user giving wrong input. It\'s Ok that it\'s not saving anything in database while a user giving wrong input. But there is no error message in user view page. If anyone find the error, please help me out. Here is the controller: public function saveUser(Request $request){ $this->validate($request,[ \'name\' => \'required|max:120\', \'email\' => \'required|email|unique:users\', \'phone\' => \'required|min:11|numeric\', \'course_id\'=>\

How to protect image from public view in Laravel 5?

旧时模样 提交于 2019-11-26 02:57:30
问题 I have installed Laravel 5.0 and have made Authentication. Everything is working just fine. My web site is only open for Authenticated members. The content inside is protected to Authenticated members only, but the images inside the site is not protected for public view. Any one writes the image URL directly can see the image, even if the person is not logged in to the system. http://www.somedomainname.net/images/users/userImage.jpg My Question: is it possible to protect images (the above URL

Can Anyone Explain Laravel 5.2 Multi Auth with Example

随声附和 提交于 2019-11-26 00:29:51
问题 I am trying to authenticate users and admin form user table and admin table respectively. I am using the User model as provided by laravel out of the box and created the same for Admin. I have added a guard key and provider key into auth.php. Guards \'guards\' => [ \'user\' =>[ \'driver\' => \'session\', \'provider\' => \'user\', ], \'admin\' => [ \'driver\' => \'session\', \'provider\' => \'admin\', ], ], Providers \'providers\' => [ \'user\' => [ \'driver\' => \'eloquent\', \'model\' => App