Bagisto Forum

    Bagisto

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    Class not found

    General Discussion
    2
    16
    989
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R
      rahul last edited by

      Hi @cmpengineers

      Don' need to add src, second one is right.

      C 1 Reply Last reply Reply Quote 0
      • C
        cmpengineers @rahul last edited by

        Dear @rahul

        thats what i did still showing me class not found ?

        namespace Drov\Address\Http\Controllers;
        
        use Illuminate\Http\Request;
        use packages\Drov\Address\Models\Area;
        
        <?php
        
        namespace packages\Drov\Address\Models;
        
        use Illuminate\Database\Eloquent\Model;
        
        class Area extends Model
        {
            //
        }
        
        

        Screen Shot 2020-03-12 at 1.50.40 PM.png

        is there another solution ?

        i did create the model manually not using php artisan does that cause not to work ?

        only the migration file i did it with php artisan

        Please advise ?

        Best regards

        1 Reply Last reply Reply Quote 0
        • R
          rahul last edited by

          Hi @cmpengineers

          You have used wrong namespace.

          Did your model is present like (Directory structure) -

          Packages->Drov->Address->Models->Area.

          Is that directory structure for your model.

          Thanks

          C 1 Reply Last reply Reply Quote 0
          • C
            cmpengineers @rahul last edited by cmpengineers

            Dear @rahul

            yes that is correct , the error shows the

            <?php
            
            namespace Drov\Address\Http\Controllers;
            
            use Illuminate\Http\Request;
            use packages\Drov\Address\Models\Area; // when you want to use the model you put the whole path correct ?
            
            

            the error is from the AreaController where it cant see the model

            the full path to Area.php model

            packages/Drov/Address/src/Models

            best regards

            1 Reply Last reply Reply Quote 0
            • C
              cmpengineers last edited by

              Screen Shot 2020-03-12 at 2.03.36 PM.png

              i have to insert Area in order to use it

              $area = new Area();
              
              1 Reply Last reply Reply Quote 0
              • R
                rahul last edited by rahul

                Hi @cmpengineers

                Just use like -

                \Area
                
                C 1 Reply Last reply Reply Quote 0
                • C
                  cmpengineers @rahul last edited by

                  @rahul

                  /Area 
                  

                  where do you mean ?

                  use packages\Drov\Address\Models\Area;
                  // like this
                  use packages/Drov/Address/Models/Area; // it does not. work error 
                  
                  1 Reply Last reply Reply Quote 0
                  • R
                    rahul last edited by rahul

                    @cmpengineers

                    I mean only -

                    use \Area;
                    
                    1 Reply Last reply Reply Quote 0
                    • C
                      cmpengineers last edited by

                      Dear @rahul

                      it doesnt work , error happens

                      Screen Shot 2020-03-12 at 2.52.27 PM.png

                      Screen Shot 2020-03-12 at 2.52.20 PM.png

                      Best regards

                      1 Reply Last reply Reply Quote 0
                      • R
                        rahul last edited by

                        Hello @cmpengineers

                        Push your code on git hub or git lab, and add me.
                        I need to check.

                        C 1 Reply Last reply Reply Quote 0
                        • C
                          cmpengineers @rahul last edited by

                          Dear @rahul

                          finally its working i only needed to add App\

                          use App\packages\Drov\src\Models\Area;

                          Best regards

                          1 Reply Last reply Reply Quote 0
                          • C
                            cmpengineers last edited by

                            Dear @rahul

                            use App\packages\Drov\src\Models\Area; // this is the one that is working 
                            

                            i really appreciate it your effort

                            Best regards

                            R 1 Reply Last reply Reply Quote 0
                            • R
                              rahul @cmpengineers last edited by

                              This post is deleted!
                              1 Reply Last reply Reply Quote 0
                              • First post
                                Last post