• 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.8k
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.
  • 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
      • Y
        youssefboudaya last edited by 5 Aug 2019, 12:37

        i did these changes but i still can't access that url i think there is an error somewhere else here is my whole project: https://we.tl/t-ZxQA9ugf6s

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

          Hi @youssefboudaya

          I am unable to open your file but i think you are missing these things -

          1. Add this to app.php file (Inside Config folder ).
          ACME\HelloWorld\Providers\HelloWorldServiceProvider::class
          
          1. Add this to composer.json under 'psr-4'.
          "ACME\\HelloWorld\\": "packages/ACME/HelloWorld/src"
          

          Run 'php artisan config:clear', 'composer dump-autoload' & 'php artisan vendor:publish'.

          and please see attached image for where your package should be -

          ACME.png

          Thanks

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

            This post is deleted!
            1 Reply Last reply Reply Quote 0
            • Y
              youssefboudaya last edited by 6 Aug 2019, 10:13

              thanks a lot i did all those edits in my project then php artisan config:clear , composer dump-autoload , php artisan route:cache and it worked.The problem now is when i go to hello-world i get this displayed "helloworld::app.hello-world.name"

              1 Reply Last reply Reply Quote 0
              • R
                rahul last edited by 6 Aug 2019, 10:17

                Hi @youssefboudaya

                You need to add language for this.

                <?php
                
                return [
                    'hello-world' => [
                        'name' => 'My Name is jane doe',
                    ]
                ];
                

                in app.php file for en.

                Thanks

                Y 1 Reply Last reply 6 Aug 2019, 10:23 Reply Quote 0
                • Y
                  youssefboudaya @rahul last edited by 6 Aug 2019, 10:23

                  @rahul thanks a lot it worked !!

                  1 Reply Last reply Reply Quote 0
                  • 5 months later
                  • R
                    rabol last edited by 3 Jan 2020, 14:15

                    Hi

                    is it possible to get a copy as I have the same problem with at package, so a 'base', working example would be great

                    Thanks

                    1 Reply Last reply Reply Quote 0
                    • R
                      rahul last edited by 8 Jan 2020, 07:30

                      Hi @rabol

                      We don't have any copy of this but you can mentioned your error or any problem that you are facing, we will solve it.

                      Thanks

                      1 Reply Last reply Reply Quote 0
                      • R
                        rabol last edited by 8 Jan 2020, 19:52

                        Hi

                        May I suggest that you create a 'bolier-plate' for a new package and put it on github, I'm sure that it would help a lot.

                        Thanks

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