Models, Forms, Validation - Part 2 | PHP MVC Framework from Scratch

Поделиться
HTML-код
  • Опубликовано: 23 янв 2025

Комментарии • 85

  • @englishwitheugene
    @englishwitheugene 2 года назад +2

    You're the best bro! Your php videos are the best on RUclips. Thanks!

  • @gustavoconti3431
    @gustavoconti3431 4 года назад +6

    This is amazing! Very informative, different approaches, which one is best and why. Definitely going to see this all the way through.

  • @jetzemeilink
    @jetzemeilink 3 года назад +1

    Awesome series, what I most enjoy about this series is that you take us with you in your thought process about how to implement things and what the pros and cons are when you implement them. Thank you very much

  • @obiekene9200
    @obiekene9200 3 года назад +2

    The tutorial is awesome and i'm really enjoying every seconds of it.

    • @TheCodeholic
      @TheCodeholic  3 года назад

      Amazing. Thanks for your comment

  • @rajabhishek2936
    @rajabhishek2936 4 года назад +7

    great series dude.....awsoem content

  • @flairesupport
    @flairesupport 2 года назад +2

    im using sublimetext, i dont have phpstorm, in phpstorm "use app\core\Model" is auto generated or by means of keys, but in sublimetext you need to type it manually. so if you miss that u lost that "use" at the top of the php file and its gives you an error.. so better use phpstorm to follow the tutorial smoothly.. nice work mate!

  • @topalek
    @topalek 4 года назад +8

    Awesome tutorial! Keep goin'

  • @hayatzee8830
    @hayatzee8830 2 года назад

    Thank you so much for the fun-straigh forward-easy to follow course.
    So I suppose the majority of the audience here are juniors, Can you please throw a video with tips and advices on how to find a job for junior developers (also remote jobs).
    I am sure everyone here will appreciate that! thank you again Zura!

  • @borakayalar
    @borakayalar 3 года назад +1

    You are awesome, you are making amazing things with php, I try to validation with jquery but php acting like jquery it is perfect. I will continue other videos.

  • @murunwascengy2762
    @murunwascengy2762 4 года назад

    I'm a donet guy but I find this very interesting... Thanks you 🥇🥇🥇

  • @uocmolamdev9879
    @uocmolamdev9879 3 года назад +1

    Awesome sir!

  • @panggilmeiamMusic
    @panggilmeiamMusic 3 года назад

    "That's way people said: PHP is ugly language, because of it,I hate it!" - Mentor
    But the mentor keep going with the tutorial series! and I am laugh very loud in my house and keep watching it!
    DOUBLE KILL TWITS!

  • @ghulamhyder2628
    @ghulamhyder2628 4 года назад +2

    great video 👌

  • @kevinnacario359
    @kevinnacario359 2 года назад

    Hi sir, thank you so much. Very clean code and lots of juicy stuff.

  • @shaikhanuman8012
    @shaikhanuman8012 4 года назад +1

    tq sir, this video also very good and i learn new skills from these video tq sir.

  • @MohamedSayed-bl5ww
    @MohamedSayed-bl5ww 18 дней назад

    i have one question , based on the MVC when the routing system determine which contoller should used for this paraicular request ,it should the controller module call the view not the render that exist in the Router class to achieve the goal of the MVC design that says the controller speak with view,,may you explain this point please , Thanks!

  • @m-agoumi
    @m-agoumi 4 года назад

    hello, the solution you did for the error you got on 46:46 didn't work for me, do you have any idea why? my PHP version is 7.4.9 and after I var_dump($this) on __toString() in core/form/Field.php I got [object(app\core\form\Field)#9 (0) {
    ["model"]=>
    uninitialized(app\core\Model)
    ["attribute"]=>
    uninitialized(string)
    }]

    • @TheCodeholic
      @TheCodeholic  4 года назад

      If you assign some value to firstnamw it should not give you the error any more.
      Pay attention... maybe there is different error and not the same one

    • @nicolasbonilla2155
      @nicolasbonilla2155 4 года назад

      @@TheCodeholic Hi. I am having this error
      Fatal error: Uncaught Error: Call to a member function field() on string in C:\xampp\htdocs\MVCF\views
      egister.php:5 in the same part.

    • @nicolasbonilla2155
      @nicolasbonilla2155 4 года назад

      it said that is undefined %model in register.php but I imported Model in Field... :/:/ heeeelp

    • @nicolasbonilla2155
      @nicolasbonilla2155 4 года назад

      I dump $model and gave me this
      object(app\models\RegisterModel)#7 (6) {
      ["firstname"]=>
      string(0) ""
      ["lastname"]=>
      string(0) ""
      ["email"]=>
      string(0) ""
      ["password"]=>
      string(0) ""
      ["confirmPassword"]=>
      string(0) ""
      ["errors"]=>
      array(0) {
      }
      }

    • @TheCodeholic
      @TheCodeholic  4 года назад +1

      There is a problem in creating $form variable.
      Check the github repository and compare the code and understand what is different.

  • @fajar312
    @fajar312 4 года назад +1

    Thank you from Indonesian programmer

  • @longjump6315
    @longjump6315 3 года назад +1

    Great job!

  • @mohammadtaheri98
    @mohammadtaheri98 4 года назад

    great series dude. love it

  • @mustafaagha8834
    @mustafaagha8834 3 года назад +1

    Great tutorial

  • @julianvogel5523
    @julianvogel5523 4 года назад +1

    WOW.... just awesome =D

  • @imannugroho195
    @imannugroho195 4 года назад +2

    Love from indonesia

  • @geneartista9714
    @geneartista9714 4 года назад +2

    Now this is an advance way of coding that I`m looking for

    • @TheCodeholic
      @TheCodeholic  4 года назад +4

      Thanks buddy.
      I finished recording and posting videos on framework.. The only thing I am thinking to add is to setup it on xampp or deploy it on heroku.
      Let's see if many people asks about it...

    • @geneartista9714
      @geneartista9714 4 года назад +1

      Well I hopefully wish you will make one and please be assured that I will share your fb page to my friends on FB, I'm still a student and don't the have an income yet so this is my own way of showing gratitude

    • @TheCodeholic
      @TheCodeholic  4 года назад +1

      Thank you my friend.
      Sharing and liking is absolutelly enough.

  • @WEBAREAit
    @WEBAREAit 2 года назад

    Hi.thank you for this tutorial. i got an error on Field.php.
    Fatal error: Uncaught Error: Typed property App\core\form\Field::$model must not be accessed before initialization in C:\xampp\htdocs\wagestNEW\core\form\Field.php:28 Stack trace: #0 C:\xampp\htdocs\wagestNEW\views
    egister.php(14):
    Seems that i have to initialize in Field.php the property
    public Model $model;
    But, How do I initialize it? Thanks!

  • @imtiazshamim
    @imtiazshamim 3 года назад

    From Bangladesh ❤️

  • @dwisusiloatmojo
    @dwisusiloatmojo 2 года назад +1

    Hi sir, thank you for this amazing tutorial, how to resolve RULE::UNIQUE when updating data? when old data is not changed will be a problem because the error message appears "Record with this field already exists", how to overcome it? I apologize if my grammar is not polite

  • @deZOO77
    @deZOO77 2 года назад

    Anyone knows how to customize in phpstorm method var_dump() to show up with tags automaticly? Like in 23:03

    • @TheCodeholic
      @TheCodeholic  2 года назад

      You need to create live template

    • @deZOO77
      @deZOO77 2 года назад +1

      @@TheCodeholic Nice :) thx man, working perfectly. It''ll save me a lot of time ;)

  • @ilmurlocdiplomato3071
    @ilmurlocdiplomato3071 2 года назад

    Can this be implemented with other type of input? For example select? And if yes how?

  • @moussaouimehdi734
    @moussaouimehdi734 4 года назад

    awesome and nice tuto . i would like to know in the case of checkbox , radio o textarea we implements anohters functions to treat this type because you just treat the case of input text and thank you

  • @ready_rounder
    @ready_rounder 4 года назад

    App\core folder is missing in Github repo

  • @PeterMumford
    @PeterMumford Год назад

    The form validation could be done easily in the browser (with javascript), before the form ever gets submitted. The submit button can be disabled until the form is valid. I'm not sure what the advantage of doing it on the server is.

    • @TheCodeholic
      @TheCodeholic  Год назад +2

      Doing validation on client side is great but never enough. A little experienced person can easily bypass javascript validation and submit the form. It you don't have backend validation invalod data will appear in the database.
      My advice is to always do backend valodation first and javascript validation is bonus.

    • @PeterMumford
      @PeterMumford Год назад

      @@TheCodeholic Gotcha. That makes sense.

  • @54M1WUL
    @54M1WUL 4 года назад +1

    Can u make a full project like e commerce? It wud be a good project to learn

  • @lanreoreyomi9555
    @lanreoreyomi9555 4 года назад +1

    Plese do you have a PHP for beginner course. You are very knowledgeable and I love how you teach.

    • @TheCodeholic
      @TheCodeholic  4 года назад

      Yes I do have 5 hours course on my channel.

    • @geneartista9714
      @geneartista9714 4 года назад

      @@TheCodeholic Is PHP your main PL or most used PL?

    • @TheCodeholic
      @TheCodeholic  4 года назад

      At the moment PHP is my mostly used programming language.
      Generally I try to be language agnostic.

    • @geneartista9714
      @geneartista9714 4 года назад

      @@TheCodeholic and Laravel is your most used framework? am I right?
      After this, will you be making a laravel tutorial ?

    • @TheCodeholic
      @TheCodeholic  4 года назад +2

      Laravel is the most popular and demanded framework... Yes I will make Laravel tutorials also...

  • @hassanhafiz44
    @hassanhafiz44 4 года назад

    Hi sir, thank you for this amazing tutorial. I'm learning a lot from it. I reached from 1st video to this one and I have a question. Maybe it would have been done in the next videos but I'm asking just out of curiosity. Wouldn't it be better to have validation on Request instead of a model?

  • @Kay8B
    @Kay8B 3 года назад

    @ 45:05 what is this called when your accessing the variables in the object? Learn about it first here
    I also added a function for cleaner looking labels:
    protected function cleanLabel( String $word)
    {
    $words = preg_split('/(?=[A-Z])/', $word, 0, PREG_SPLIT_NO_EMPTY);

    return ucwords(implode(' ', $words));
    }
    Just throw the attribute in here.
    THANK YOU ZURA BTW

  • @ilya_123__
    @ilya_123__ 10 месяцев назад

    thank you!

  • @Akosiyawin
    @Akosiyawin 4 года назад

    how can you do that code template, when you enter dump it autocomplete with and exit; thats amazing.

    • @TheCodeholic
      @TheCodeholic  4 года назад +1

      I have configured PHPStorm Live templates

  • @eslamabdallahabass5662
    @eslamabdallahabass5662 Год назад

    when changing the filed type you could just pass the type argument to filed __construct
    like this
    public function __construct(Model $model, string $attribute, string $label, string $type, string $placeholder)
    {
    $this->model = $model;
    $this->attribute = $attribute;
    $this->label = $label;
    $this->type = $type;
    $this->placeholder = $placeholder;
    }
    and in field you can do something like this
    echo $form->filed($model, 'name', 'Enter your name', 'text', 'Dev Alison');
    won't that be better ?

    • @fahemlove
      @fahemlove Год назад

      عظمة على عضمة

  • @jakubgadzala7474
    @jakubgadzala7474 3 года назад

    Hey, one question if I may: How did you learn all of it? Mostly at work?

    • @TheCodeholic
      @TheCodeholic  3 года назад +2

      Mostly by working a lot.
      I wanted to understand how things were working so I dived in deep and found things.
      Work, experiment and read as much as you can.

  • @Gandobilis
    @Gandobilis 2 года назад +1

    💫

  • @shahinvan1350
    @shahinvan1350 3 года назад

    Please enter the middle codes of the project

  • @fvgoya
    @fvgoya 4 года назад

    It's REALLY a nice series. However, it's not from scratch... I thought that will be EVERYTHING from scratch, even the core code.

    • @TheCodeholic
      @TheCodeholic  4 года назад

      This is second part. Watch the first part first: ruclips.net/video/GTESlsYTUns/видео.html

  • @NganthoibaKhangenbam
    @NganthoibaKhangenbam 4 года назад

    hello, please also make video for REST API in php

  • @asadbekdeveloper4599
    @asadbekdeveloper4599 2 года назад

    we have one mistake. Register form reload and load main layout .

  • @mr.marshmello6699
    @mr.marshmello6699 4 года назад

    i dindt se it but it seams great cuz therei is no turorials on this concept

  • @sebastianszydlowski5834
    @sebastianszydlowski5834 7 месяцев назад

    Anyone doing this in 2024? Got stuck here and maybe can someone suggest the solution:
    Fatal error: Uncaught TypeError: app\core\form\Form::field(): Argument #1 ($model) must be of type app\core\Model, null given, called in C:\MAMP\htdocs\views
    egister.php on line 30 and defined in C:\MAMP\htdocs\app\core\form\form.php:23 Stack trace: #0 C:\MAMP\htdocs\views
    egister.php(30): app\core\form\Form->field(NULL, 'name') #1 C:\MAMP\htdocs\app\core\Router.php(93): include_once('C:\\MAMP\\htdocs\\...') #2 C:\MAMP\htdocs\app\core\Controller.php(8): app\core\Router->renderView('register', Array) #3 C:\MAMP\htdocs\app\controllers\authController.php(38): app\core\Controller->render('register', Array) #4 [internal function]: app\controllers\authController->register(Object(app\core\Request)) #5 C:\MAMP\htdocs\app\core\Router.php(69): call_user_func(Array, Object(app\core\Request)) #6 C:\MAMP\htdocs\app\core\Application.php(24): app\core\Router->resolve() #7 C:\MAMP\htdocs\public\index.php(26): app\core\Application->run() #8 {main} thrown in C:\MAMP\htdocs\app\core\form\form.php on line 23

  • @khanprinters7104
    @khanprinters7104 Год назад

    Awesome series, what I most enjoy about this series is that you take us with you in your thought process about how to implement things and what the pros and cons are when you implement them. Thank you very much

    • @TheCodeholic
      @TheCodeholic  11 месяцев назад

      Thanks for your comment. I appreciate it.