Zura I'm really impressed by your knowledge, thank you for this great series. Understanding what is happening under the hood of these frameworks is so helpful.
@@TheCodeholic After a job interview I noticed my lack of php knowledge. Shortly after I found you roadmap and after working on it for a while I had to do another project for a job interview and I passed. They offered me a job and I'm already working as a dev. Thanks Zura!
Hello, I have two questions to ask you: - (Issue 1) At minute 21:10, why did you use self::class instead of $this::class? - (Issue 2) At minute 23:00, the tableName() method is not static, but why were you able to call it?
$this to refer to the current object. Use self to refer to the current class. In other words, use $this->member for non-static members, use self::$member for static members.
In php 7.4 that was allowed, but it will not work in your version probably, so either yiu should make the tableName method static or use it with $this keyword.
Greetings and thank you for this great series. I ran in some trouble with "Array and string offset access syntax with curly braces is no longer supported". As a workaround I added an array $values inside the Model class an stored the $data from loadData function in it. In the DBModel I changed the bindValue to: $statement->bindValue(":$attribute",$this->values[$attribute]); not really sure if this is a good solution or if it is safe. Feedback would be really nice. ANd maybe some tutorial about security, especially file uploads.
Hello Zura, great job! I'm really enjoying the video. However, whenever I try doing a var_dump($statement, $params, $attributes); as in 11:08 the $statement variable is showing up as NULL. Any ideas on why this is happening?
@user-ou3vl6ez9l Maybe you didn't provide public function getAttributes(): array { return ['firstname', 'lastname', 'email', 'password', 'status']; } in the User.php file
Thank you. I eventually found the error. There was a typo in one of the functions. Did not note which one but it was a missing arrow in this case.@@NargisGasimli-qb1qv
First of all great job, thank you for sharing your knowledge. I have a question. In 27:44 you are talking about redirecting to home page after user is successfully registered. Why not use render method with params?
finally decent tutorials. I learn alot. would you do a tutorial about creating a model with single base model with out active directory. your technique is too advance. Thank you
Hello, how are you, greetings. A few days ago I started this tutorial and I'm new to programming with PHP, I got this error: 'Fatal error: Uncaught Error: Call to a member function bindValue() on null in C:\xampp\htdocs\Proyectos-Canal-The -Codeholic-RUclips\php-mcv-framework\core\DbModel.php:30' with the save() method of the DbModel.php file when trying to insert a record with the variable $statement->bindValue(":$attribute" , $this->{$attribute});. Any solution? Thank you.
Howdy! A question: after password_hash I have as many dots in input-password field as in hash string, but you still has the of inputted password in your input field. why?? thanx =)
@@TheCodeholic Thank you! Yes I did ) But I did it the same way you did. I see it in User class in save() method where $this->password = password_hash(...), so it goes to view from here, I guess. Should we use another property for password hash to save or what did I miss? =)
Sorry for the noob question Zura. But can you explain this line: $this->labels()[$attribute] ?? $attribute; I'm not sure about what's happening with the syntaxe here, after the call to labels() function, how are you adding the [$attribute] right after. Also, Thank you for this series 🙏
it may be too late))) , but i will try to explain it. So he calls the function "labels" and it returns an array, after that he uses the key "$attribute" to take the value from this array.It is same as doing: $labels=$this->labels(); return $labels[$attribute].
Is it not safe to just use the execute when passing the values like pdo->execute( 'firstname' => $firstname ); and I hope that you`ll have a PHP Laravel tutorial
No, it's not safe, Do no ever do that if you are inserting to database, or even if selecting, always bind it, to avoid sql injections. Imagine: you have a query like= pdo->execute(select * from users where id = $ID), in which the ID is 2 for example, so the injection can happen if a user inserted a value of like: 2 OR > 0. These will show all the users in table. This is a bad explanation, just search it.
@@geneartista9714 Darwin is wrong here, values of an array in the execute method are also sanitized for SQL. There are some minor differences (e.g. when you use an array, all values are passed as PDO::PARAM_STR). But for simple queries, it's a matter of preference really.
Guys who faced the infinite action, look carefully, when Unset happens, it refers to the array and not to a specific cell of the array. I hope I can help someone, (half an hour of debugging)
Hi Zura! Great videos! I have a Warning that I can't find what is the issue even watched that video 3 times. I am sure I miss something small that I hope you can help me. edit: "error messages disappeared so I deleted them, I just cant see the message 'Thanks for registering' and at this code below, I am noticing that $key is grey out and says: "Unused local variable" at phpstorm. Thank you in advance! [code] public function __construct() { session_start(); $flashMessages = $_SESSION[self::FLASH_KEY] ?? []; foreach ($flashMessages as $key => &$flashMessage) { $flashMessage['remove'] = true; } $_SESSION[self::FLASH_KEY] = $flashMessages; } [/code]
Greetings from Kenya. Your are the best RUclips Trainer in the Known universe
Wow, thank you very much.
Greetings from Bangladesh. Your are the best RUclips Trainer in the Known universe
Woop, Woop, part 4 and I'm really expressed by your knowlege. That's just great, you should do an Udemy course or something like that;)
Thanks a lot buddy. I am thinking about Udemy course, Just I don't have time for that now
Zura I'm really impressed by your knowledge, thank you for this great series. Understanding what is happening under the hood of these frameworks is so helpful.
Thanks buddy
@@TheCodeholic After a job interview I noticed my lack of php knowledge. Shortly after I found you roadmap and after working on it for a while I had to do another project for a job interview and I passed. They offered me a job and I'm already working as a dev. Thanks Zura!
Wow...
That's amazing.. Congrats to you buddy.
You deserved it. Happy to hear that my roadmap helped people to get a job
Hello! Your lessons are awesome! Thank You very much! Very actual and helpful information. Waiting for more lessons 😊
Great tutorial videos! I'm enjoying!!!!!
Thanks buddy
thanks dude, probably the best curse i have ever seen.
Thanks buddy
"How ever ..." 😁 Thanks for sharing your knowledge dude!
very modern php framework thank you Zura The Codeholic
Hello, I have two questions to ask you:
- (Issue 1) At minute 21:10, why did you use self::class instead of $this::class?
- (Issue 2) At minute 23:00, the tableName() method is not static, but why were you able to call it?
$this to refer to the current object. Use self to refer to the current class. In other words, use $this->member for non-static members, use self::$member for static members.
In php 7.4 that was allowed, but it will not work in your version probably, so either yiu should make the tableName method static or use it with $this keyword.
Greetings and thank you for this great series. I ran in some trouble with "Array and string offset access syntax with curly braces is no longer supported". As a workaround I added an array $values inside the Model class an stored the $data from loadData function in it. In the DBModel I changed the bindValue to: $statement->bindValue(":$attribute",$this->values[$attribute]); not really sure if this is a good solution or if it is safe. Feedback would be really nice. ANd maybe some tutorial about security, especially file uploads.
Hello Zura, great job! I'm really enjoying the video. However, whenever I try doing a var_dump($statement, $params, $attributes); as in 11:08 the $statement variable is showing up as NULL. Any ideas on why this is happening?
@user-ou3vl6ez9l Maybe you didn't provide
public function getAttributes(): array
{
return ['firstname', 'lastname', 'email', 'password', 'status'];
}
in the User.php file
Thank you. I eventually found the error. There was a typo in one of the functions. Did not note which one but it was a missing arrow in this case.@@NargisGasimli-qb1qv
First of all great job, thank you for sharing your knowledge. I have a question. In 27:44 you are talking about redirecting to home page after user is successfully registered. Why not use render method with params?
finally decent tutorials. I learn alot. would you do a tutorial about creating a model with single base model with out active directory. your technique is too advance. Thank you
Hello, how are you, greetings. A few days ago I started this tutorial and I'm new to programming with PHP, I got this error: 'Fatal error: Uncaught Error: Call to a member function bindValue() on null in C:\xampp\htdocs\Proyectos-Canal-The -Codeholic-RUclips\php-mcv-framework\core\DbModel.php:30' with the save() method of the DbModel.php file when trying to insert a record with the variable $statement->bindValue(":$attribute" , $this->{$attribute});. Any solution? Thank you.
thank you! it is great tutorial!
Zura tnx a lot for your work. Keep going. Best wishes.
p.s. where you learned english or how?
Howdy! A question: after password_hash I have as many dots in input-password field as in hash string, but you still has the of inputted password in your input field. why?? thanx =)
You probably assigned the hashed password back into the variable which outputs in the input field.
@@TheCodeholic Thank you! Yes I did ) But I did it the same way you did. I see it in User class in save() method where $this->password = password_hash(...), so it goes to view from here, I guess. Should we use another property for password hash to save or what did I miss? =)
Thanks. You are the best
Thanks buddy.
hey man how are you? really love your videos ... can you make videos on laravel .. it would be really helpfull...
Thanks a lot. I definitely plan to make Laravel projects, but can not tell exactly when. But I will do...
Nice tutorial
Thanks
Awosem dude
Thanks man
At 23.04 How can we call a non-static method like a static method?
@AmitDas-yb3re It's Class not a object. For example User::tableName()
You can call the class method directly
Sorry for the noob question Zura. But can you explain this line:
$this->labels()[$attribute] ?? $attribute;
I'm not sure about what's happening with the syntaxe here, after the call to labels() function, how are you adding the [$attribute] right after.
Also, Thank you for this series 🙏
it may be too late))) , but i will try to explain it. So he calls the function "labels" and it returns an array, after that he uses the key "$attribute" to take the value from this array.It is same as doing:
$labels=$this->labels();
return $labels[$attribute].
Session is not working
Is it not safe to just use the execute when passing the values like
pdo->execute(
'firstname' => $firstname
);
and I hope that you`ll have a PHP Laravel tutorial
No, it's not safe, Do no ever do that if you are inserting to database, or even if selecting, always bind it, to avoid sql injections. Imagine: you have a query like= pdo->execute(select * from users where id = $ID), in which the ID is 2 for example, so the injection can happen if a user inserted a value of like: 2 OR > 0. These will show all the users in table. This is a bad explanation, just search it.
@@Akosiyawin thanks man that`s quite helpful
@@geneartista9714 Darwin is wrong here, values of an array in the execute method are also sanitized for SQL. There are some minor differences (e.g. when you use an array, all values are passed as PDO::PARAM_STR). But for simple queries, it's a matter of preference really.
💫
Guys who faced the infinite action, look carefully, when Unset happens, it refers to the array and not to a specific cell of the array. I hope I can help someone, (half an hour of debugging)
Hi Zura! Great videos! I have a Warning that I can't find what is the issue even watched that video 3 times. I am sure I miss something small that I hope you can help me.
edit:
"error messages disappeared so I deleted them, I just cant see the message 'Thanks for registering' and
at this code below, I am noticing that $key is grey out and says: "Unused local variable" at phpstorm. Thank you in advance!
[code]
public function __construct()
{
session_start();
$flashMessages = $_SESSION[self::FLASH_KEY] ?? [];
foreach ($flashMessages as $key => &$flashMessage) {
$flashMessage['remove'] = true;
}
$_SESSION[self::FLASH_KEY] = $flashMessages;
}
[/code]
Wow, same part as mine. Did you fix it?