H
H
HeartOfProgrammer2016-03-25 21:33:10
Laravel
HeartOfProgrammer, 2016-03-25 21:33:10

How to set permissions in laravel?

There is an online store, there is such a function to add a product. It is necessary that when a person enters the site there is a login form, after if the person is an administrator and he enters his username and password, he will have such access that he can delete and change products on the site.
PS Maybe the question was not correctly composed, but I did not know how to put the question correctly.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrzej Wielski, 2016-03-25
@HeartOfProgrammer

Use Entrust to manage roles and access.

A
ajaxtelamonid, 2016-03-26
@ajaxtelamonid

In Laravel 5.2 (more precisely, since 5.1.11) there are wonderful internal means of differentiating access rights (authorization). Plus, in 5.2, for the feature of an additional login by the administrator, you can write your own authentication guard. Or you can not do it, just set a flag in the session that this user is an admin, and check this in access rights.
laravel.su/docs/5.2/authentication
laravel.su/docs/5.2/authorization

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question