Yii2 Scenarios (rules on vs scenarios() function) | FormModel Explained | Hindi Tutorial 18

Published: 24 September 2025
on channel: Dynamic Duniya
35
0

Welcome to part 2 of the Yii2 FormModel & Validation series!
In this video, we explore Scenarios in Yii2, which allow you to define different validation rules for different situations.

We’ll cover two powerful methods:
1️⃣ Using on in rules() to attach rules directly to scenarios.
2️⃣ Overriding the scenarios() function for full control over which attributes are active in each scenario.

🔥 Example Used in This Video:

Register Scenario → username, email, password, confirm password (with compare rule).

Login Scenario → username, password only.

By the end of this video, you’ll know exactly when to use on and when to use scenarios() for real-world Yii2 applications.

👉 Perfect for handling multi-step forms, different use-cases, or admin vs user validations.


🔗 Follow for more tutorials on Yii2, PHP, and Web Development
👍 Don’t forget to Like and Share this video
🔔 Hit the Bell icon to get notified about the next video

Chapters -
00:00 - Introduction and Previous Recap
00:22 - Validations Rules
01:00 - Filter Validator
03:22 - Safe Validator
05:47 - Custom Inline Validator
07:12 - on Scenario
10:31 - Scenario() Function
15:16 - Compare Validator (Password & Confirm Password)
17:43 - Unique Validator
19:55 - File Validator
22:58 - Summary

Follow on Linkedin -
  / dynamic-duniya  
  / aayushmhu  


My Recording Gears-
Microphone - https://amzn.to/46kYtO0

Documentations -
https://www.yiiframework.com/doc/api/...
https://www.yiiframework.com/doc/api/...
https://dynamicduniya.com/tutorials/p...



#Yii2 #ActiveRecord #PHPFramework #Yii2Tutorial #WebDevelopment #PHP #MySQL #Yii2Beginner
#dynamicduniya #Yii2 #Yii2Framework #PHP #PHPFramework #WebDevelopment #BackendDevelopment #PHPTutorial #Yii2Tutorial #FullStackDevelopment #MVC #ActiveRecord #DynamicModel #BaseModel #MongoDB #Redis #Elasticsearch #Database #MySQL #NoSQL #LearnPHP #CodingTutorial #Programming #WebDev #OpenSource #CodeWithMe #DeveloperLife #TechTutorial #CRUDOperations #SoftwareDevelopment #BackendEngineer #CodeNewbie #Yii2Tutorial #Yii2Widgets #PHPTutorial #WebDevelopment #YiiFramework #FullStackDevelopment
#dynamicduniyaofficial
#Yii2Framework
#Yii2TutorialHindi
#PHPBackendDevelopment
#PHPWebDevelopment
#Yii2ForBeginners
#BackendDevelopmentHindi
#WebDevelopmentHindi
#PHPHindiTutorial
#Yii2AdvancedTutorial
#LearnYii2Hindi
#Yii2 #PHPFramework #WebDevelopment #Yii2Tutorial #PHPDevelopers
#CodingTutorial #WebApplication #LearnYii2 #RenderMethods #PHPProgramming
#BackendDevelopment #FullStackDevelopment #PHPFrameworks #WebDevCommunity
#CodeWithMe #YiiFramework #AdvancedPHP #DevelopersLife #RenderViews
#Yii2 #PHP #Yii2Tutorial #HindiTutorial #WebDevelopment #yii2 #php #webdevelopment #formvalidation #activeform


On this page of the site you can watch the video online Yii2 Scenarios (rules on vs scenarios() function) | FormModel Explained | Hindi Tutorial 18 with a duration of hours minute second in good quality, which was uploaded by the user Dynamic Duniya 24 September 2025, share the link with friends and acquaintances, this video has already been watched 35 times on youtube and it was liked by 0 viewers. Enjoy your viewing!