kossa / laradminator

Integration of Adminator into Laravel 6.x/7.x/8.x with RTL support
https://laradminator.kossa.one/admin
MIT License
227 stars 73 forks source link

How to implement laradminator for existing project. #10

Closed rizkyarlin closed 6 years ago

rizkyarlin commented 6 years ago

I have write several back end codes for my laravel project. Now I want to implement laradminator. I copy the package.json and webpack.mix.js to my project. Then I run npm i then npm run production

I got this error:

`fs.js:948 binding.stat(pathModule._makeLong(path)); ^

Error: ENOENT: no such file or directory, stat '/home/vagrant/code/admin/resources/assets/static/images' at Object.fs.statSync (fs.js:948:11) at Object.statSync (/home/vagrant/code/admin/node_modules/graceful-fs/polyfills.js:297:22) `

kossa commented 6 years ago

Alright it's possible , you have to copy/paste assets

and the then run npm run production

Dont forget to follow the the classes : https://github.com/kossa/laradminator/blob/master/resources/views/admin/default.blade.php

rizkyarlin commented 6 years ago

This happens:

vagrant@homestead:~/code/admin$ npm run production

> @ production /home/vagrant/code/admin
> cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js

 ERROR  Failed to compile with 2 errors                                 00:45:48

These dependencies were not found:

* /home/vagrant/code/admin/resources/assets/js/app.js in multi ./resources/assets/js/app.js ./resources/assets/sass/app.scss
* /home/vagrant/code/admin/resources/assets/sass/app.scss in multi ./resources/assets/js/app.js ./resources/assets/sass/app.scss

To install them, you can run: npm install --save /home/vagrant/code/admin/resources/assets/js/app.js /home/vagrant/code/admin/resources/assets/sass/app.scss
fs.js:948
  binding.stat(pathModule._makeLong(path));
          ^

Error: ENOENT: no such file or directory, stat '/home/vagrant/code/admin/resources/assets/static/images'
    at Object.fs.statSync (fs.js:948:11)
    at Object.statSync (/home/vagrant/code/admin/node_modules/graceful-fs/polyfills.js:297:22)
    at Object.copySync (/home/vagrant/code/admin/node_modules/fs-extra/lib/copy-sync/copy-sync.js:31:86)
    at File.copyTo (/home/vagrant/code/admin/node_modules/laravel-mix/src/File.js:190:12)
    at FileCollection.copyTo (/home/vagrant/code/admin/node_modules/laravel-mix/src/FileCollection.js:82:24)
    at src.forEach.file (/home/vagrant/code/admin/node_modules/laravel-mix/src/FileCollection.js:76:38)
    at Array.forEach (<anonymous>)
    at FileCollection.copyTo (/home/vagrant/code/admin/node_modules/laravel-mix/src/FileCollection.js:76:17)
    at CopyFilesTask.run (/home/vagrant/code/admin/node_modules/laravel-mix/src/tasks/CopyFilesTask.js:14:20)
    at CustomTasksPlugin.runTask (/home/vagrant/code/admin/node_modules/laravel-mix/src/webpackPlugins/CustomTasksPlugin.js:33:14)
    at Mix.tasks.forEach.task (/home/vagrant/code/admin/node_modules/laravel-mix/src/webpackPlugins/CustomTasksPlugin.js:9:44)
    at Array.forEach (<anonymous>)
    at Compiler.compiler.plugin.stats (/home/vagrant/code/admin/node_modules/laravel-mix/src/webpackPlugins/CustomTasksPlugin.js:9:23)
    at Compiler.applyPlugins (/home/vagrant/code/admin/node_modules/tapable/lib/Tapable.js:61:14)
    at emitRecords.err (/home/vagrant/code/admin/node_modules/webpack/lib/Compiler.js:264:11)
    at Compiler.emitRecords (/home/vagrant/code/admin/node_modules/webpack/lib/Compiler.js:371:38)
    at emitAssets.err (/home/vagrant/code/admin/node_modules/webpack/lib/Compiler.js:258:10)
    at applyPluginsAsyncSeries1.err (/home/vagrant/code/admin/node_modules/webpack/lib/Compiler.js:364:12)
    at next (/home/vagrant/code/admin/node_modules/tapable/lib/Tapable.js:218:11)
    at Compiler.compiler.plugin (/home/vagrant/code/admin/node_modules/webpack/lib/performance/SizeLimitsPlugin.js:99:4)
    at Compiler.applyPluginsAsyncSeries1 (/home/vagrant/code/admin/node_modules/tapable/lib/Tapable.js:222:13)
    at Compiler.afterEmit (/home/vagrant/code/admin/node_modules/webpack/lib/Compiler.js:361:9)
    at require.forEach.err (/home/vagrant/code/admin/node_modules/webpack/lib/Compiler.js:350:15)
    at /home/vagrant/code/admin/node_modules/webpack/node_modules/async/dist/async.js:473:16
    at iteratorCallback (/home/vagrant/code/admin/node_modules/webpack/node_modules/async/dist/async.js:1064:13)
    at /home/vagrant/code/admin/node_modules/webpack/node_modules/async/dist/async.js:969:16
    at /home/vagrant/code/admin/node_modules/graceful-fs/graceful-fs.js:43:10
    at FSReqWrap.oncomplete (fs.js:135:15)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ production: `cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @ production script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/vagrant/.npm/_logs/2018-06-26T00_45_48_982Z-debug.log
kossa commented 6 years ago

Did you run : npm install

rizkyarlin commented 6 years ago

@kossa yes, I did. But still not working

Can you give me complete step how to do it? This will help many others. You could add it to your readme, under the setup section. Thanks :D

rizkyarlin commented 6 years ago

@kossa, Now the login is working.

But I got this error when calling the dashboard.

Use of undefined constant ADMIN - assumed 'ADMIN' (this will throw an Error in a future version of PHP)

I tried to copy your web.php, still is not working. I know I can just remove every route(ADMIN), but I think it's better to patch the the finger instead of cutting entire hand

kossa commented 6 years ago

Good, to make admin route access dynamic and configurable I added those lines

rizkyarlin commented 6 years ago

Thank you...