Giter Site home page Giter Site logo

coolsam726 / jetstream-inertia-generator Goto Github PK

View Code? Open in Web Editor NEW
118.0 9.0 30.0 1.74 MB

Laravel 8 Admin CRUD generator built with Jetstream, Inertia js, Vue 3 and Tailwindcss 2

License: MIT License

PHP 19.69% Blade 47.08% Vue 32.53% JavaScript 0.37% TypeScript 0.32% CSS 0.01%
laravel crud-generator admin-generator tailwindcss inertia inertiajs vue vuejs vue3 savannabits

jetstream-inertia-generator's Introduction

JIG v3.x - Jetstream Powered Admin CRUD Generator

Latest Version on Packagist GitHub code size in bytes Travis (.com) Build Scrutinizer build Total Downloads

⚠️ We will maintain this repository up to Laravel 9, as we continue improving its successor, Savannabits/Acacia which is more manageable, modular and totally separate from your main application. Check it out, and please give a star if you like it. Thank you for your support!

Jetstream Inertia Generator a.k.a jig allows you to generate code for simple Admin CRUDs (Create, Read, UPdate, Delete) which are fully compatible with a Laravel Project powered by the Jetstream - Inertia - Vue.js Stack. Preview

Scenario

You are developing a NextGen project. The data model is complex. It requires Many CRUDS managed by the admin in order to power the main end-user functionality. You don't want to spend Days or even Months writing boilerplate code for all the CRUDs. If that is you, this package comes to your rescue. Just follow these simple steps:

  • Generate a Migration for your CRUD table, e.g articles, and run php artisan migrate (About 2 minutes)
  • With this package, just run php artisan jig:generate articles (About 3 seconds!!!)
  • Build your css and javascript (About 27 seconds) DONE! In about 2 and a half minutes, you get a fully working module consisting of -:
  • Model
  • Admin Controller - Index, Create, Show, Edit, Store, Update, Delete
  • API Controller - Index, Store, Show, Update, Delete
  • An Authorization Policy - viewAny, view, create, update, delete, restore, forceDelete
  • Generated Permissions for spatie/laravel-permissions - articles, articles.index, articles.create, articles.show, articles.edit, articles.delete
  • Frontend Menu entry
  • Frontend Datatable with Actions thanks to Using Yajra Datatables and datatables.net
  • Tailwindcss-powered CREATE and EDIT forms,
  • Tailwindcss - powered SHOW view.
  • web and API routes
  • Validation and Authorization Request Classes

What more could you ask for? Cut a day's work down to less than 3 minutes.

I don't like configurations, give me a working code!

No worries. If the steps below are too much, we have a starter template for near-zero setup which you can use to start your project without the initial config below. Checkout the JIG Template Here to get started. Simply click Use This Template.

Dependencies

If you have followed the Jetstream - Inertia - Vue.js Installation instructions, then the project will work with minimal configuration. Other Important dependencies that you MUST configure include:

  1. Spatie Laravel Permissions - This is used to manage roles and permissions. Its migrations will be published during asset publishing, after which you can go ahead and configure the user trait.
  2. Laravel Sanctum - Used to manage both API and stateful authentication. Since the whole app will be a Single Page Application, make sure you configure the middleware sanctum middleware in app/Http/Kernel.php as follows:
'api' => [
    \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
    ...
],

If you are using v2.x

NB: This documentation is for v3.x of JIG. If you are using v2.x, Access v2.x Docs Here

Before You Install:

  • Ensure you have installed laravel/jetstream with inertia.

Installation

  1. You can install the package via composer:
composer require savannabits/jetstream-inertia-generator

⚠️ 1. Before proceeding, ensure you have installed laravel/jetstream with inertia.

⚠️ 2. Step 1 will install spatie/laravel-permission. Ensure you have published migrations for this package to create roles and permissions tables before proceeding.

php artisan vendor:publish --provider="Spatie\Permission\PermissionServiceProvider"

💡 NB: The title field will be automatically added to the roles and permissions tables when the first CRUD is generated. :::

  1. Install the necessary npm dev dependencies by running the following command: If you are using npm:
npm install --include=dev --legacy-peer-deps @headlessui/vue @inertiajs/inertia @inertiajs/inertia-vue3 @vitejs/plugin-vue popper.js @babel/plugin-syntax-dynamic-import dayjs dotenv numeral postcss postcss-import pusher-js laravel-echo laravel-vite sass sass-loader vite vue@^3.1 vue3-vt-notifications vue-flatpickr-component  vue-numerals mitt vue-select@^4 dynamic-import-polyfill

Or if you are using yarn:

yarn add -D @headlessui/vue @vitejs/plugin-vue @inertiajs/inertia @inertiajs/inertia-vue3 popper.js @babel/plugin-syntax-dynamic-import dayjs dotenv numeral postcss postcss-import pusher-js laravel-echo laravel-vite sass sass-loader vite vue@^3.1 vue3-vt-notifications vue-flatpickr-component  vue-numerals mitt vue-select@^4 dynamic-import-polyfill

Feel free to configure the color palette to your own preference, but for uniformity be sure to include primary,secondary, success and danger variants since they are used in the jig template.

  1. Publish the Package's assets, configs, templates, components and layouts. This is necessary for you to get the admin layout and all the vue components used in the generated code:

Option 1 (Suitable for fresh installations)

php artisan vendor:publish --force --provider="Savannabits\JetstreamInertiaGenerator\JetstreamInertiaGeneratorServiceProvider"

Option 2 (Useful if you are upgrading the package or already have local changes you don't want to override.) NB: If you only want to update some published files, delete only the published files that you want to update, then run the appropriate command below:

php artisan vendor:publish --tag=jig-blade-templates #Publishes resources/views/app.blade.php. If it already exists, use --force to replace it
php artisan vendor:publish --tag=jig-config #Publishes the config file. If it exists use --force to replace it.
php artisan vendor:publish --tag=jig-routes #Publishes routes/jig.php to hold routes for generated modules.If you have already generated some routes, be sure to back them up as this file will be reset if you --force it.
php artisan vendor:publish --tag=jig-views #publishes Vue Components, app.js, bootstrap.js and Layout files. Use --force to force replace
php artisan vendor:publish --tag=jig-scripts #publishes main.ts and Layout files. Use --force to force replace
php artisan vendor:publish --tag=jig-css #publishes app.css. Use --force to force replace
php artisan vendor:publish --tag=jig-assets #publishes logos and other assets
php artisan vendor:publish --tag=jig-compiler-configs #publishes postcss.config.js,vite.config.js, tsconfig.json and tailwind.config.js
php artisan vendor:publish --tag=jig-seeders #Publish database Seeders
  1. Add the JigMiddleware to the web middleware group in app/Http/Kernel.php:
protected $middlewareGroups = [
    'web' => [
        ...,
        \Savannabits\JetstreamInertiaGenerator\Middleware\JigMiddleware::class,
    ],
];
  1. Allow First-Party access to the Sanctum API by adding the following to the api middleware group in app/Http/Kernel.php
protected $middlewareGroups = [
    'api' => [
        \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
        ...
    ],
];
  1. Modify the .env to have the following keys:
APP_BASE_DOMAIN=mydomain.test
# or https
APP_SCHEME=http
#optional mix_app_uri (The path under which the app will be served. It is recommended to run the app from the root of the domain.
MIX_APP_URI= 
#If MIX_APP_URI is empty.
APP_URL=${APP_SCHEME}://${APP_BASE_DOMAIN} 
#If MIX_APP_URI is not empty.
#APP_URL=${APP_SCHEME}://${APP_BASE_DOMAIN}/${MIX_APP_URI}

# Append the following key to your .env to allow 1st party consumption of your api:
#You can add other comma separated domains
SANCTUM_STATEFUL_DOMAINS="${APP_BASE_DOMAIN}"
  1. create the storage:link (See laravel documentation) to allow access to the public disk assets (e.g logos) via web:
php artisan storage:link
  1. For v3 only, set the scripts in your package.json as follows:
"scripts": {
        "dev": "vite",
        "build": "vite build",
        "serve": "vite preview"
    },
  1. Enable Profile Photos by uncommenting the following line in config/jetstream.php under 'features':
Features::profilePhotos(),
  1. Run Migrations and Seeders
php artisan migrate
php artisan db:seed --class SeedAdminRoleAndUser
  1. Now build the npm dependencies using vitejs:
yarn dev #Start the vitejs development server
yarn build #build assets for production

🚀 You are now ready to generate your CRUDs!🎉

Usage

The initial seeded admin user and role

When you run php artisan vendor:publish --tag=jig-migrations, a migration is published that creates an initial default user called Administrator and a role with the name administrator to enable you gain access to the system with admin privileges. The credentials for the user account are:

Use these creds after migration to login and explore all parts of the application

Create the Permissions, Roles and Users Modules first, in that order:

Run the following commands to generate the User Access Control Module before proceeding to generate your admin:

php artisan jig:generate:permission -f
php artisan jig:generate:role -f
php artisan jig:generate:user -f

You can now proceed to generate any other CRUD you want using the steps in the following section.

General Steps to generate a CRUD:

  1. Generate and write a migration for your table with php artisan make:migration command.
  2. Run the migration to the database with php artisan migrate command
  3. Generate the Whole Admin Scaffold for the module with php artisan jig:generate command
  4. Modify and customize the generated code to suit your specific requirements if necessary. __NB: If the crud already exists, and you would like to generate, you can use the -f or --force option to force replacement of files.

Example

Assuming you want to generate a books table:

php artisan make:migration create_books_table

books-crud

  • Open your migration and modify it as necessary, adding your fields. After that, run the migration.
php artisan migrate
  • The Fun Part: Scaffold a whole admin module for books with jig using the following command:
php artisan jig:generate books #Format: php artisan generate [table_name] [-f]

NB: To get a full list of jig commands called under the hood and the full description of the jig:generate command, you can run the following:

php artisan jig --help
php artisan jig:generate --help

The command above will generate a number of files and add routes to both your api.php and web.php route files. It will also append menu entries to the published Menus.json file. The generated vue files are placed under the Pages/Books folder in the js folder.

  • Finally, run yarn dev or yarn build to compile the assets. There you have your CRUD.

Roles, permissions and Sidebar Menu:

  • By Default, generation of a module generates the following permissions:

    • index
    • create
    • show
    • edit
    • delete
  • The naming convention for permissions is ${module-name}.${perm} e.g payments.index, users.create etc.

  • This package manages access control using policies. Each generated module generates a policy with the default laravel actions:

    • viewAny, view, store, update, delete, restore, forceDelete The permissions generated above are checked in these policies. If you need to modify any of the access permissions, policies is where to look.
  • Special permissions MUST also be generated to control access to the sidebar menus. These permissions SHOULD NOT contain two parts separated with a dot, but only one part.

  • Menus are configured in a json file published at ./resources/js/Layouts/Jig/Menu.json.

    • For all menu items, the json key MUST match the permision that controls that menu. A permission without any verb is generated when generating each module for this very purpose. For example, generating a payments module will generate a payments permission. Then the menu for payments must have payments as the json key.
    • For parent menus and any other menus which may not match any module, you have to create a permission with the key name to control its access. For example, if you have a parent menu called master-data you have to generate a permission with the same name.

Components Documentation

Datatables

JIG is built on top of datatables.net and is fully server-side rendered using Yajra Datatables. Most of the logic resides inside App\Repositories and in the respective Repository file, there is a method called dtColumns which is used to fully control the columns shown in the Index page.

For example, in order to control the columns shown for the Users Datatable, the following is the dtColumns method under App\Repositories\Users.php:

public static function dtColumns(): array
    {
        return [
            Column::make('id')->title('ID')->className('all text-right'),
            Column::make("name")->className('all'),
            Column::make("first_name")->className('none'),
            Column::make("last_name")->className('none'),
            Column::make("middle_name")->className('none'),
            Column::make("username")->className('min-desktop-lg'),
            Column::make("email")->className('min-desktop-lg'),
            Column::make("gender")->className('min-desktop-lg'),
            Column::make("dob")->className('none'),
            //Column::make("email_verified_at")->className('min-desktop-lg'),
            Column::make("activated")->className('min-desktop-lg'),
            Column::make("created_at")->className('min-tv'),
            Column::make("updated_at")->className('min-tv'),
            Column::make('actions')->className('min-desktop text-right')->orderable(false)->searchable(false),
        ];
    }

NOTE: In order to omit the email_verified_at class from my Index columns all I had to do is comment it out (or better yet, just remove it from the list of columns!)

The datatables are also responsive by default (Checkout https://datatables.net/extensions/responsive/ for more details). For this purpose, you can use one of the following jig-provided responsive breakpoints to automatically collapse the column below a given screen size. For info on how to use the class logic, checkout the Class Logic Documentation. Most of the time I only use min-, e.g min-desktop-l

breakpoints: [
        { name: "tv", width: Infinity },
        { name: "desktop-l", width: 1536 },
        { name: "desktop", width: 1280 },
        { name: "tablet-l", width: 1024 },
        { name: "tablet-p", width: 768 },
        { name: "mobile-l", width: 480 },
        { name: "mobile-p", width: 320 },
    ],
}

Checkout the first snippet on how I have used the responsive classes!

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

jetstream-inertia-generator's People

Contributors

coolsam726 avatar gbrits avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jetstream-inertia-generator's Issues

Add break-words to ShowForm

Sometimes showForm may have longer than usual words, such as long keys. In this case it is necessary to use tailwind's break-words to allow wrapping of these keys.

InfiniteSelect Error: Can't find stylesheet to import.

Describe the bug
While running yarn build, Typescript throws the following error:
Error: Can't find stylesheet to import.

2 │ @import "~vue-select/src/scss/vue-select.scss";
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

resources/js/JigComponents/InfiniteSelect.vue 2:9 root stylesheet

To Reproduce

  1. Install using normal steps as described
  2. Run yarn build

Add default admin user

Currently it is hard to start the application after setup because there is no system user. Adding a migration to seed the default admin user with administrator role would help

\Auth::user()->can() generated in Models has no null check

The getCanAttribute() function in generated model should have an Auth::check() in order to still be able to use the model when no user is logged in. Currently it throws errors

Example fix:

public function getCanAttribute() {
        return [
            "view" => \Auth::check() ? \Auth::user()->can("view", $this) : false,
            "update" => \Auth::check() ? \Auth::user()->can("update", $this) : false,
            "delete" => \Auth::check() ? \Auth::user()->can("delete", $this) : false,
            "restore" => \Auth::check() ? \Auth::user()->can("restore", $this) : false,
            "forceDelete" => \Auth::check() ? \Auth::user()->can("forceDelete", $this) : false,
        ];
    }

DataTables warning: table id=users-dt - Ajax error. For more information about this error, please see http://datatables.net/tn/7

Bug Description
When i try to click backend modules it sends "DataTables warning: table id=users-dt - Ajax error. For more information about this error, please see http://datatables.net/tn/7" error

To Reproduce
Steps to reproduce the behavior:

  1. After install jig and 'php artisan serve' and login. Go to 'backend'
  2. Click on 'permissions or roles or users'
  3. It will show pop up and display the error with 'DataTables warning: table id=users-dt - Ajax error. For more information about this error, please see http://datatables.net/tn/7'

Expected behavior
I dont know why this is happen, it's my first time use jig, maybe the problem is yajra datatables

Screenshots
I want to share a screenshot but i don't know how to do it, i will send it later after i find out

Desktop:

  • OS: [windows 11 pro]
  • Browser [microsoft edge]

Dependency Issue

Describe the bug
I'm setting a new project using this package jetstream-inertia-generator
and I got a dependency issue.

To Reproduce
Steps to reproduce the behavior:

  1. New Laravel 8 instalation
  2. Add Laravel Jetstream using Inertia
    https://jetstream.laravel.com/2.x/introduction.html
  3. Requeriments listed in README.md:
    :: spatie/laravel-permission
    composer require spatie/laravel-permission
    php artisan vendor:publish --provider="Spatie\Permission\PermissionServiceProvider"
    php artisan optimize:clear
    php artisan migrate
    :: laravel/sanctum
    composer require laravel/sanctum
    php artisan vendor:publish --provider="Laravel\Sanctum\SanctumServiceProvider"
    php artisan migrate
  4. Finaly, install:
    composer require savannabits/jetstream-inertia-generator --with-all-dependencies
  5. See error

Expected behavior
This error message:

composer require savannabits/jetstream-inertia-generator --with-all-dependencies
Using version ^3.0 for savannabits/jetstream-inertia-generator
./composer.json has been updated
Running composer update savannabits/jetstream-inertia-generator --with-all-dependencies
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - savannabits/jetstream-inertia-generator[v3.0.0-beta.0, ..., v3.0.4] require spatie/laravel-permission ^4.2 -> found spatie/laravel-permission[4.2.0, ..., v4.x-dev] but it conflicts with your root composer.json require 
(^5.3).
    - Root composer.json requires savannabits/jetstream-inertia-generator ^3.0 -> satisfiable by savannabits/jetstream-inertia-generator[v3.0.0-beta.0, ..., v3.0.4].

You can also try re-running composer require with an explicit version constraint, e.g. "composer require savannabits/jetstream-inertia-generator:*" to figure out if any version is installable, or "composer require savannabits/jetstream-inertia-generator:^2.1" if you know which you need.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

Desktop (please complete the following information):

  • OS: Windows 10
  • Composer version 2.1.10 2021-10-29 22:34:57

** Update 1: **
I see this is related to the conflict between the required spatie/laravel-permission:^4.2 and my compose which requires the latest ^5.3 version.
Could you please upgrade it to the new spatie/laravel-permission series?

How to remove column from index view

How I can control which column are displayed for a given index view?
By default, Jig shows all the field names in the Index. I don't want this most times.

Use Jajra/Datatables instead of Pagetables

Is this something we could consider for better responsiveness and flexibility? The goal was to avoid using jQuery at all costs but it seems that for the best datatables solutions, we are still stuck with jquery for now.

Could not resolve './Deselect'

How can I resolve the following error?

*✓ 287 modules transformed.
Could not resolve './Deselect' from node_modules\vue-select\src\components\childComponents.js
error during build:
Error: Could not resolve './Deselect' from node_modules\vue-select\src\components\childComponents.js
at error (C:\laragon\www\fig\node_modules\rollup\dist\shared\rollup.js:158:30)
at ModuleLoader.handleResolveId (C:\laragon\www\fig\node_modules\rollup\dist\shared\rollup.js:22345:24)
at C:\laragon\www\fig\node_modules\rollup\dist\shared\rollup.js:22319:26
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Support php 8.2

Problem 1
- savannabits/jetstream-inertia-generator[v1.0.0, ..., v1.1.0, v2.0.0, ..., v2.1.4] require php ^7.4 -> your php version (8.2.2) does not satisfy that requirement.
- savannabits/jetstream-inertia-generator[v2.2.0, ..., v2.2.3] require illuminate/support ^v8.40 -> found illuminate/support[v8.40.0, ..., v8.83.27] but these were not loaded, likely because it conflicts with another require.
- savannabits/jetstream-inertia-generator[v2.3.0, ..., v2.4.0, v3.0.0, ..., v3.1.0] require illuminate/support ^8 -> found illuminate/support[v8.0.0, ..., v8.83.27] but these were not loaded, likely because it conflicts with another require.
- savannabits/jetstream-inertia-generator v3.2.0 requires inertiajs/inertia-laravel ^0.4 -> found inertiajs/inertia-laravel[v0.4.0, ..., v0.4.5] but it conflicts with your root composer.json require (^0.6.8).
- savannabits/jetstream-inertia-generator[v3.2.1, ..., v3.3.0] require inertiajs/inertia-laravel ^0.5 -> found inertiajs/inertia-laravel[v0.5.0, ..., v0.5.4] but it conflicts with your root composer.json require (^0.6.8).
- Root composer.json requires savannabits/jetstream-inertia-generator * -> satisfiable by savannabits/jetstream-inertia-generator[v1.0.0, ..., v1.1.0, v2.0.0, ..., v2.4.0, v3.0.0, ..., v3.3.0].

Readme

Hi, thanks for you making this available. Here is a minor suggestion for the readme.

In the installation instructions it says "2. Install the yarn dependencies listed above" - but they're not listed above. Maybe delete that, or provide the list.

So instead I adapted the yarn command (I use NPM). For npm it is

npm install --save-dev pagetables popper.js @babel/plugin-syntax-dynamic-import dayjs dotenv numeral portal-vue postcss postcss-import pusher-js laravel-echo sass sass-loader vue3-vt-notifications vue-flatpickr-component vue-numerals vue-pdf mitt "https://github.com/sagalbot/vue-select/tarball/feat/vue-3-compat"

You could include that for npm users.

Make Relationships Optional in Show page

For optional belongsTo Relationships, trying to access a nested key throws a js error. e.g if books.author is optional, the generated code still tries to access books.author.name without checking for null first. This throws a javascript error.

PHP 8

Any plans on supporting PHP 8!

Really diggin what I'm seeing here and PHP 8 support would be awesome!

Cheers!

Modification of boilerplate

How can I adjust myself auto generated code for field titles?
To make changes that will suite my needs inside
views, repository dtColumns() and api controller index()?

I ask because i have 300 columns table
To make it more manageable i thought about making own helper class that will accept field name and return title. That way it will be possible to change things centrally for many places in app.

It would be something like this in php:

Column::make('field_name')->title(report_title('field_name'))

Or in Vue form

<jet-label for="field_name" :value="fields.field_name.title" />

I'm actually thinking about long and short titles (forms and data tables) and more, like types of values for stats, advanced filters.

what is index action in controller in API being used for

what is index action in controller in API being used for?

public function index(IndexStore $request)
{
$query = Store::query(); // You can extend this however you want.
$cols = [
Column::name('id')->title('Id')->sort()->searchable(),
Column::name('location_name')->title('Location Name')->sort()->searchable(),
Column::name('address_1')->title('Address 1')->sort()->searchable(),
Column::name('address_2')->title('Address 2')->sort()->searchable(),
Column::name('city')->title('City')->sort()->searchable(),
Column::name('province')->title('Province')->sort()->searchable(),
Column::name('email')->title('Email')->sort()->searchable(),
Column::name('phone_no')->title('Phone No')->sort()->searchable(),
Column::name('updated_at')->title('Updated At')->sort()->searchable(),

        Column::name('actions')->title('')->raw()
    ];
    $data = Pagetables::of($query)->columns($cols)->make(true);
    return $this->api->success()->message("List of Stores")->payload($data)->send();
}

public function dt(Request $request) {
    $query = Store::query()->select(Store::getModel()->getTable().'.*'); // You can extend this however you want.
    return $this->repo::dt($query);
}

Fix the Show Form

Show form seems to have misplaced tags and lacks the space-y-separator.

Pagetables don't work with self join.

Pagetables don't work with self join. Below is query that works perfectly fine with Yaraja tables.

$cols = [
        Column::name('id')->title('Id')->sort()->searchable(),
        Column::name('nazwa')->title('Nazwa')->sort()->searchable(),
        Column::name('ulica_so')->title('Ulica So')->sort()->searchable(),
        Column::name('kod_so')->title('Kod So')->sort()->searchable(),
        Column::name('poczta_so')->title('Poczta So')->sort()->searchable(),
    ];

$query = Branch::leftJoin('branches as pow','branches.pow_id','=','pow.id')
                       ->leftJoin('branches as woj','branches.woj_id','=','woj.id')
                       ->select('branches.id',
                                'branches.nazwa',
                                'branches.ulica_so',
                                'branches.kod_so',
                                'branches.poczta_so',
                                'pow.nazwa as pow_nazwa',
                                'woj.nazwa as woj_nazwa');

$data = Pagetables::of($query)->columns($cols)->make(true);

This causes error:

Column 'id' in where clause is ambiguous

(SQL: select `branches`.`id`, `branches`.`nazwa`, `branches`.`ulica_so`, `branches`.`kod_so`, `branches`.`poczta_so`, `pow`.`nazwa` as `pow_nazwa`, `woj`.`nazwa` as `woj_nazwa` from `branches` left join `branches` as `pow` on `branches`.`pow_id` = `pow`.`id` left join `branches` as `woj` on `branches`.`woj_id` = `woj`.`id` where (`id` LIKE %% or `nazwa` LIKE %% or `ulica_so` LIKE %% or `kod_so` LIKE %% or `poczta_so` LIKE %%))

Problem is that column names are passed to WHERE part without table name.

I was trying to go around this problem trying to exclude id from searching but further problems turned out:

Column::name('id')->title('Id')->sort()->searchable(false);

ends with error
Unknown column '' in 'where clause'

(SQL: select `branches`.`id`, `branches`.`nazwa`, `branches`.`ulica_so`, `branches`.`kod_so`, `branches`.`poczta_so`, `pow`.`nazwa` as `pow_nazwa`, `woj`.`nazwa` as `woj_nazwa` from `branches` left join `branches` as `pow` on `branches`.`pow_id` = `pow`.`id` left join `branches` as `woj` on `branches`.`woj_id` = `woj`.`id` where (`` LIKE %% or `nazwa` LIKE %% or `ulica_so` LIKE %% or `kod_so` LIKE %% or `poczta_so` LIKE %%))

Column::name('id')->title('Id')->sort()->searchable(false)->raw(true);

ends with error
Savannabits\Pagetables\Pagetables::applySearch(): Argument #1 ($column) must be of type Savannabits\Pagetables\Column, null given,

I'm sorry for harrassing with issues. I'd love to help you but im currently working till late nights on deadline. Ill help with docs when ill finish.

Submenu - no proper documentation or example available

Sub menu not working for me there is also not much documentation or example for that

I tried this :

"categories": {
"route": "admin.categories.index",
"title": "Categories",
"routePattern": "admin.categories.",
"faIcon": "far fa-clone",
"isTitle": true,
"isParent": true,
"children": [{"sub-categories": {
"route": "admin.sub-categories.index",
"title": "Sub Categories",
"routePattern": "admin.categories.
",
"faIcon": "far fa-clone",
"isTitle": false,
"isParent": false,
"children": []
}}]
},

innocenzi/laravel-vite package should be removed for laravel 10

in the composer.json file intended for laravel 10 there is still the innocenzi/laravel-vite package
it should be removed in order to install jetstream-inertia-generator correctly
otherwise, the following error appears when trying to load the page

ERROR: htmlspecialchars(): Argument #1 ($string) must be of type string, array given {"view":{"view":"/var/www/html/dev/resources/views/app.blade.php","data":[]},"exception":"[object] (Spatie\LaravelIgnition\Exceptions\ViewException(code: 0): htmlspecialchars(): Argument #1 ($string) must be of type string, array given at /var/www/html/dev/vendor/laravel/framework/src/Illuminate/Support/helpers.php:124)

Cant install vue-select

During installation, when running:
npm install --include=dev --legacy-peer-deps savannabits/vue-select#v4.0.0-alpha.0

i get error:
npm ERR! code 128
npm ERR! An unknown git error occurred
npm ERR! command git --no-replace-objects ls-remote ssh://[email protected]/savannabits/vue-select.git
npm ERR! Warning: Permanently added the RSA host key for IP address '140.82.121.4' to the list of known hosts.
npm ERR! [email protected]: Permission denied (publickey).
npm ERR! fatal: Could not read from remote repository.

Can sagalbot/vue-select be used instead?

Error after fresh installation - Laravel 8

Describe the bug
Performed a fresh installation with Laravel 8.

Loading the home page, I'm returned the following error:

nnocenzi\Vite\Exceptions\ManifestNotFound The manifest could not be found. Did you start the development server? Tried: /var/www/html/public/build/manifest.json (View: /var/www/html/resources/views/app.blade.php)

Expected behavior
Page loads correctly.

Screenshots
Screen Shot

Missing dependencies

Step 11
Installation process is missing module vite/dynamic-import-polyfill

I've installed it as /dynamic-import-polyfill and updated /resources/scripts/main.ts accordingly.
I guess it works same as vite module.


Also code inside resources/js/app.js seems to be wrong (consists require command) or missing requirejs module.
The app is throwing :
Uncaught ReferenceError: require is not defined at app.js:1

Excel export

How do Excel/export boilerplate work?
I can see generator adds this to controllers:

use App\Exports\ClassNameExport; 
use Maatwebsite\Excel\Excel //<-- no semicolon

But except that cant find out how data export works?

More info on features needed

How displaying messages/errors work?
It stopped working for me and I dont know how to fix it.
I see method inside Create.vue views:

onSuccess(msg) {
    this.displayNotification('success',msg);
}

But cant figure it out, where the code goes further.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.