• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Register
  • Login
Bagisto Forum

Bagisto

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

How To Create Package ?

General Discussion
4
29
5.6k
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.
  • Y
    youssefboudaya last edited by 2 Aug 2019, 12:29

    Hi , i just installed bagisto and followed the documentation on how to add a package when i reached step 7 i tried to access hello-world url but i get 404 page not found !

    1 Reply Last reply Reply Quote 0
    • R
      rahul last edited by 2 Aug 2019, 13:31

      Hi @youssefboudaya

      Please run following commands -

      1. 'composer dump-autoload'
      2. 'php artisan route:cache'

      Thanks

      1 Reply Last reply Reply Quote 0
      • Y
        youssefboudaya last edited by youssefboudaya 2 Aug 2019, 13:53 2 Aug 2019, 13:50

        i did those commands and nothing happened my project url is "http://localhost:7777/bagisto/public/"
        this is the url i want to access http://localhost:7777/bagisto/public/hello-world .
        this is the architecture of my package :0ee4803d-1d11-4a5c-ba27-8a9a8c641647-image.png

        1 Reply Last reply Reply Quote 0
        • R
          rahul last edited by 2 Aug 2019, 14:05

          Hi @youssefboudaya

          Can you attach your browser's image when you serving http://localhost:7777/bagisto/public/

          Thanks

          1 Reply Last reply Reply Quote 0
          • Y
            youssefboudaya last edited by 2 Aug 2019, 14:14

            https://we.tl/t-tTCqCgOQiT

            1 Reply Last reply Reply Quote 0
            • R
              rahul last edited by 2 Aug 2019, 14:20

              Hi @youssefboudaya

              Can you attach for this url also - http://localhost:7777/bagisto/public/hello-world

              Thanks

              1 Reply Last reply Reply Quote 0
              • Y
                youssefboudaya last edited by 2 Aug 2019, 14:34

                https://we.tl/t-wwTTncgor6

                ghermans 1 Reply Last reply 3 Aug 2019, 11:46 Reply Quote 0
                • R
                  rahul last edited by 2 Aug 2019, 14:43

                  Hi @youssefboudaya

                  Can you show, how did you created route & make sure it is working.

                  Thanks

                  1 Reply Last reply Reply Quote 0
                  • ghermans
                    ghermans @youssefboudaya last edited by 3 Aug 2019, 11:46

                    @youssefboudaya

                    open HelloWorldServiceProvider.php and change your boot method to this

                    /**
                        * Bootstrap services.
                        *
                        * @return void
                        */
                        public function boot()
                        {
                            $this->loadRoutesFrom(__DIR__ . '/../Http/routes.php');
                            $this->loadTranslationsFrom(__DIR__.'/../Resources/lang', 'helloworld');
                            $this->loadViewsFrom(__DIR__.'/../Resources/views', 'helloworld');
                        }
                    

                    Inside your package open src/Http/routes.php and add this at the end of the file
                    replace yourpackage and viewname with yours.

                    Route::view('/hello-world', 'yourpackage::viewname');
                    

                    go the the root folder of bagisto and run the following commands

                    composer dump-autoload
                    php artisan route:cache
                    

                    Once that is done open your browser and go to http://localhost:7777/bagisto/public/hello-world and verify if it works.

                    Kind regards,
                    Glenn Hermans

                    Manager Bagisto Europe
                    info@bagisto.eu

                    1 Reply Last reply Reply Quote 0
                    • Y
                      youssefboudaya last edited by 5 Aug 2019, 08:33

                      it didnt work can i upload my project here to check for errors ?

                      1 Reply Last reply Reply Quote 0
                      • R
                        rahul last edited by 5 Aug 2019, 09:14

                        Hi @youssefboudaya

                        Upload your package only & we will check and let you know.

                        Thanks

                        1 Reply Last reply Reply Quote 0
                        • Y
                          youssefboudaya last edited by 5 Aug 2019, 09:19

                          Thanks. https://we.tl/t-EAIrf1pmyb

                          1 Reply Last reply Reply Quote 0
                          • R
                            rahul last edited by rahul 5 Aug 2019, 10:47 5 Aug 2019, 10:45

                            Hi,

                            We have solved your errors. Kindly find the attach file.
                            What are problems in your package is -

                             $this->mergeConfigFrom(
                                  dirname(__DIR__) . '/Config/menu.php', 'menu.admin'
                             );
                            

                            you are adding your package's menu.php file with admin but your package does not consist menu.php file (Config/menu.php).

                            1. You don't use Event in your service provider but you are using it in your boot method.
                            Event::listen('bagisto.admin.layout.head', function($viewRenderEventManager) {
                                 $viewRenderEventManager->addTemplate('helloworld::helloworld.layouts.style');
                            });
                            

                            3 . Lang file will be called like this -

                            {{ __('helloworld::app.hello-world.name') }}
                                     
                                     instead of
                             {{ __(‘helloworld::app.hello-world.name’) }}
                            

                            Thanks

                            [0_1565001753477_ACME.zip](Uploading 100%)[0_1565002008993_ACME.zip](Uploading 100%)

                            1 Reply Last reply Reply Quote 0
                            • Y
                              youssefboudaya last edited by 5 Aug 2019, 10:53

                              @rahul said in How To Create Package ?:

                              0_1565002008993_ACME

                              can you please reupload the attach file

                              1 Reply Last reply Reply Quote 0
                              • R
                                rahul last edited by 5 Aug 2019, 11:03

                                Hi @youssefboudaya

                                Please mentioned your email id here, i will send it.

                                Thanks

                                1 Reply Last reply Reply Quote 0
                                • Y
                                  youssefboudaya last edited by 5 Aug 2019, 11:07

                                  youssefboudaya94@gmail.com

                                  1 Reply Last reply Reply Quote 0
                                  • R
                                    rahul last edited by 5 Aug 2019, 11:18

                                    Hi

                                    I sent it.

                                    Thanks

                                    1 Reply Last reply Reply Quote 1
                                    • Y
                                      youssefboudaya last edited by 5 Aug 2019, 11:38

                                      i didn't recieve the email.

                                      1 Reply Last reply Reply Quote 0
                                      • ghermans
                                        ghermans last edited by 5 Aug 2019, 11:39

                                        @rahul it might be a good idea to write here the cause of the problem so people can learn from it?

                                        Kind regards,
                                        Glenn Hermans

                                        Manager Bagisto Europe
                                        info@bagisto.eu

                                        1 Reply Last reply Reply Quote 1
                                        • R
                                          rahul last edited by rahul 5 Aug 2019, 11:49 5 Aug 2019, 11:48

                                          Hi @ghermans @youssefboudaya

                                          1. HelloWorldServiceProvider.php file
                                          <?php
                                          
                                          namespace ACME\HelloWorld\Providers;
                                          use Event;
                                          use Illuminate\Support\ServiceProvider;
                                          
                                          /**
                                          * HelloWorld service provider
                                          *
                                          * @author    Jane Doe <janedoe@gmail.com>
                                          * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
                                          */
                                          class HelloWorldServiceProvider extends ServiceProvider
                                          {
                                              /**
                                              * Bootstrap services.
                                              *
                                              * @return void
                                              */
                                              public function boot()
                                              {
                                                  $this->loadRoutesFrom(__DIR__ . '/../Http/routes.php');
                                          
                                                  $this->loadTranslationsFrom(__DIR__.'/../Resources/lang', 'helloworld');
                                          
                                                  $this->loadViewsFrom(__DIR__.'/../Resources/views', 'helloworld');
                                          
                                                  Event::listen('bagisto.admin.layout.head', function($viewRenderEventManager) {
                                                      $viewRenderEventManager->addTemplate('helloworld::helloworld.layouts.style');
                                                  });
                                          
                                                  $this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations');
                                              }
                                          
                                              /**
                                              * Register services.
                                              *
                                              * @return void
                                              */
                                              public function register()
                                              {
                                                  // $this->mergeConfigFrom(
                                                  //     dirname(__DIR__) . '/Config/menu.php', 'menu.admin'
                                                  // );
                                              }
                                          }
                                          
                                          1. helloworld.blade.php file -
                                          {{ __('helloworld::app.hello-world.name') }}
                                          
                                          {{--  @extends('admin::layouts.master')  --}}
                                          
                                          1. routes.php file
                                          <?php
                                          
                                              Route::view('/hello-world', 'helloworld::helloworld.helloworld');
                                          
                                          1. app.php file for en.
                                          <?php
                                          
                                          return [
                                              'hello-world' => [
                                                  'name' => 'My Name is jane doe',
                                              ]
                                          ];
                                          

                                          Thanks

                                          1 Reply Last reply Reply Quote 0
                                          10 out of 29
                                          • First post
                                            10/29
                                            Last post