laravel-5.3

Laravel 5.3 - htmlspecialchars() expects parameter 1 to be string

試著忘記壹切 提交于 2019-11-26 18:28:58
问题 I am new to laravel and I am enjoying it. While working on a social media project I got this error: htmlspecialchars() expects parameter 1 to be string, object given (View: C:\wamp64\www\histoirevraie\resources\views\user\profile.blade.php) I have checked some questions on this site but I have not found a question that solves my problem. this is what my profile.blade.php is made of: <ul class="profile-rows"> <li> <span class="the-label">Last visit: </span> <span class="the-value mark green">{

Group by not working - Laravel

主宰稳场 提交于 2019-11-26 16:14:24
问题 I'm not able to run this simple query in Laravel 5.3 $top_performers = DB::table('pom_votes') ->groupBy('performer_id') ->get(); It gives me: SQLSTATE[42000]: Syntax error or access violation: 1055 'assessment_system.pom_votes.id' isn't in GROUP BY (SQL: select * from `pom_votes` group by `performer_id`) However if I copy raw query from the error and fire directly in PhpMyAdmin, it works fine. I have already checked this: https://laravel.com/docs/5.3/queries#ordering-grouping-limit-and-offset

Laravel Passport Scopes

↘锁芯ラ 提交于 2019-11-26 12:54:26
问题 I am a bit confused on the laravel scopes part. I have a user model and table. How can I assign a user the role of user, customer and/or admin. I have a SPA with vue and laravel api backend. I use https://laravel.com/docs/5.3/passport#consuming-your-api-with-javascript Passport::tokensCan([ \'user\' => \'User\', \'customer\' => \'Customer\', \'admin\' => \'Admin\', ]); How can i assign which user model has which scope(s)? Or are scopes not the same as roles? How would you implement this?

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

How to add dynamic dropdown list column on Laravel 5.3 registration?

烈酒焚心 提交于 2019-11-26 10:00:58
问题 I want to create a dropdown list where the data retrieved from the database, ie dropdown level. the value of the dropdown level is taken from the table level. My register controller is like this : <?php namespace App\\Http\\Controllers\\Auth; use App\\User; use Validator; use App\\Http\\Controllers\\Controller; use Illuminate\\Foundation\\Auth\\RegistersUsers; class RegisterController extends Controller { use RegistersUsers; protected $redirectTo = \'/home\'; public function __construct() {

How to add some textfield in form register (laravel generator infyom)?

江枫思渺然 提交于 2019-11-26 09:14:21
问题 I read the tutorial here : http://labs.infyom.com/laravelgenerator/docs/5.3/installation I clone the admin lte generator : https://github.com/InfyOmLabs/adminlte-generator/tree/5.3 I access it in my localhost. The register form like this : https://postimg.org/image/5gswtx4gn/ I want to add some text field and combo box. eg, level, level, username etc When I access the code, I\'m confused The code is like this : Controller register is like this : <?php namespace App\\Http\\Controllers\\Auth;

Can&#39;t call Auth::user() on controller&#39;s constructor

淺唱寂寞╮ 提交于 2019-11-26 08:27:59
问题 I\'m trying to check if the user has permission to a certain model. Up until now (with Laravel 5.2), I added this code at the constructor: public function __construct() { if (!Auth::user()->hasPermission(\'usergroups\')) { abort(404); } } Now, after upgrading to Laravel 5.3, Auth::user() returns null when being called from the controller\'s constructor. If I call it within any other method of the class, it returns the currently logged in user. Any Ideas why? 回答1: See here: Session In The

Adding Access-Control-Allow-Origin header response in Laravel 5.3 Passport

≯℡__Kan透↙ 提交于 2019-11-26 08:04:47
问题 I\'m new to Laravel and am doing some Laravel 5.3 Passport project with OAuth2.0 password grant. When I curl the API with the params it responds with token. However, in browser it needs an additional security that the endpoint should add because my request is coming from localhost while the API is located in my VM. Here\'s the error: No \'Access-Control-Allow-Origin\' header is present on the requested resource. Origin \'http://localhost:8080\' is therefore not allowed access. The response

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