forked from cmacdonell/testavel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcams_notes
More file actions
33 lines (19 loc) · 939 Bytes
/
Copy pathcams_notes
File metadata and controls
33 lines (19 loc) · 939 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
store operation, creates new user and then
Redirect::to
Redirect::back (pass errors to view to display them)
Validation
----------
Laravel has a validation class
If there are other situations in which we want to validate
a user, then we want to extract the rules out of the Users::store method.
Options:
- extract rules to the model of the user
- createa a validation layer and create validation services
- first attempt: in Laravel, users 'rules' will automatically be checked by the User class (in models)
- second attempt: create an isValid method for a user, uses static methods (Laracasts Lesson 12)
Laraval -> automatic resolution, does its best to create the necessary dependencies
Now that we use an object, we can test, such as the behaviour of "isValid" with different inputs
UsersController constructor takes a User object rather than creating it in the store method.
Auth
----
Handled by Sessions controller