Logo video2dn
  • Сохранить видео с ютуба
  • Категории
    • Музыка
    • Кино и Анимация
    • Автомобили
    • Животные
    • Спорт
    • Путешествия
    • Игры
    • Люди и Блоги
    • Юмор
    • Развлечения
    • Новости и Политика
    • Howto и Стиль
    • Diy своими руками
    • Образование
    • Наука и Технологии
    • Некоммерческие Организации
  • О сайте

Скачать или смотреть Laravel API Token Authentication and Model Observers (Ep 23) - Build an Advanced Blog & CMS

  • DevMarketer
  • 2017-11-01
  • 31337
Laravel API Token Authentication and Model Observers (Ep 23) - Build an Advanced Blog & CMS
codetutorialbesteasyapiobserversmodellaravelcmssecure
  • ok logo

Скачать Laravel API Token Authentication and Model Observers (Ep 23) - Build an Advanced Blog & CMS бесплатно в качестве 4к (2к / 1080p)

У нас вы можете скачать бесплатно Laravel API Token Authentication and Model Observers (Ep 23) - Build an Advanced Blog & CMS или посмотреть видео с ютуба в максимальном доступном качестве.

Для скачивания выберите вариант из формы ниже:

  • Информация по загрузке:

Cкачать музыку Laravel API Token Authentication and Model Observers (Ep 23) - Build an Advanced Blog & CMS бесплатно в формате MP3:

Если иконки загрузки не отобразились, ПОЖАЛУЙСТА, НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если у вас возникли трудности с загрузкой, пожалуйста, свяжитесь с нами по контактам, указанным в нижней части страницы.
Спасибо за использование сервиса video2dn.com

Описание к видео Laravel API Token Authentication and Model Observers (Ep 23) - Build an Advanced Blog & CMS

This video will focus on building a token-based authentication system in Laravel 5.5. This is the default api authentication driver that Laravel uses. We will also set up an api_token field in our database and explore how we can set it to auto-populate using a little-known Laravel features called observers.

We start off by creating clearing our database and adjusting our original users table migration to add the api_token column. The reason we don’t just add this with a new migration is because we will be making the column a unique index and we already have records in our database which don’t contain unique api tokens. This causes exceptions to be thrown and because the data is all auto-generated anyway, we might as well just make life easy by removing all the data, running it fresh and re-seeding our database.

Before we seed, make sure to add the api token field in the LaraTrustSeeder.php file, so that all of our laratrust classes have api tokens to work with, since it is now required.

Now to add api_tokens to all of our other users, we will tie into the creating event, using observers.

Observers are a paradigm that allow them to watch our model for certain changes, and then jump in and manipulate or run functions with or against our model, before letting the process continue. To create an observer we will create a folder in our app folder for all future observers we might have, create the UserObserver.php file, and populate it with a basic observer template provided in the Laravel documentation.

After that, to get the observer working, we need to create a service provider that links our model to our observer and then make sure that the service provider is in our config/app file.

Once that is complete, we are ready to go. Any time we create a new user model now, the observer will jump in before the save and automatically create an api token and attach it to the model, before it passes it back to the model to complete the save.

This way we don’t actually have to worry about manually dealing with api_tokens, they will just get built for us automatically.

Hopefully this provided some new content that you can learn from. If you are new to the channel, be sure to subscribe, and remember you can always talk to me on twitter, or email me if necessary (all details below).

=== CODE SNIPPETS ===

Use this snippet to generate the random api token:

bin2hex(openssl_random_pseudo_bytes(30));


=== LINKS ===

Laravel 5.5 Observer Documentation
https://laravel.com/docs/5.5/eloquent...

Insomnia Rest Client (Mac, Windows, and Linux)
https://insomnia.rest/

Postman Rest Client (Mac, Windows, and Linux)
https://www.getpostman.com/

Paw Rest Client (Mac Only)
https://paw.cloud/

==== MORE FROM THIS SERIES . ====

Full Playlist for the "Building an Advanced Blog/CMS from Start to Finish" Series:
   • Build Advanced Blog/ CMS from Start to Finish  


==== DOWNLOAD SOURCE CODE ====

Download Code from this Episode:
https://github.com/DevMarketer/DevMar...


==== FOLLOW ME ====

Subscribe for New Releases!

Subscribe to DevMarketer Insider
https://confirmsubscription.com/h/d/5...

Twitter -   / _jacurtis  
(ask me questions!)


==== QUESTIONS? ====

Leave a comment below and I or someone else can help you.
For quick questions you may also want to ask me on Twitter, I respond almost immediately.

Email me [email protected]

Thanks for all your support!

Комментарии

Информация по комментариям в разработке

Похожие видео

  • О нас
  • Контакты
  • Отказ от ответственности - Disclaimer
  • Условия использования сайта - TOS
  • Политика конфиденциальности

video2dn Copyright © 2023 - 2025

Контакты для правообладателей [email protected]