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

Поділитися
Вставка
  • Опубліковано 14 гру 2024

КОМЕНТАРІ • 84

  • @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

  • @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!

  • @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.

  • @englishwitheugene
    @englishwitheugene 2 роки тому +2

    You're the best bro! Your php videos are the best on UA-cam. Thanks!

  • @obiekene9200
    @obiekene9200 2 роки тому +2

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

  • @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!

  • @rajabhishek2936
    @rajabhishek2936 4 роки тому +7

    great series dude.....awsoem content

  • @topalek
    @topalek 4 роки тому +8

    Awesome tutorial! Keep goin'

  • @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.

  • @fajar312
    @fajar312 4 роки тому +1

    Thank you from Indonesian programmer

  • @murunwascengy2762
    @murunwascengy2762 4 роки тому

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

  • @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!

  • @shaikhanuman8012
    @shaikhanuman8012 4 роки тому +1

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

  • @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.

  • @kevinnacario359
    @kevinnacario359 2 роки тому

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

  • @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

  • @ghulamhyder2628
    @ghulamhyder2628 4 роки тому +2

    great video 👌

  • @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.

  • @ready_rounder
    @ready_rounder 3 роки тому

    App\core folder is missing in Github repo

  • @54M1WUL
    @54M1WUL 4 роки тому +1

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

  • @ilmurlocdiplomato3071
    @ilmurlocdiplomato3071 2 роки тому

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

  • @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!

  • @uocmolamdev9879
    @uocmolamdev9879 2 роки тому +1

    Awesome sir!

  • @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 Рік тому

      عظمة على عضمة

  • @mustafaagha8834
    @mustafaagha8834 3 роки тому +1

    Great tutorial

  • @imannugroho195
    @imannugroho195 4 роки тому +2

    Love from indonesia

  • @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

  • @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.

  • @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...

  • @imtiazshamim
    @imtiazshamim 3 роки тому

    From Bangladesh ❤️

  • @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

  • @mohammadtaheri98
    @mohammadtaheri98 4 роки тому

    great series dude. love it

  • @julianvogel5523
    @julianvogel5523 4 роки тому +1

    WOW.... just awesome =D

  • @longjump6315
    @longjump6315 3 роки тому +1

    Great job!

  • @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?

  • @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.

  • @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 ;)

  • @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

  • @shahinvan1350
    @shahinvan1350 3 роки тому

    Please enter the middle codes of the project

  • @NganthoibaKhangenbam
    @NganthoibaKhangenbam 4 роки тому

    hello, please also make video for REST API in php

  • @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: ua-cam.com/video/GTESlsYTUns/v-deo.html

  • @ilya_123__
    @ilya_123__ 9 місяців тому

    thank you!

  • @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

  • @Gandobilis
    @Gandobilis 2 роки тому +1

    💫

  • @sebastianszydlowski5834
    @sebastianszydlowski5834 6 місяців тому

    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 10 місяців тому

    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  10 місяців тому

      Thanks for your comment. I appreciate it.