I am now developing a project with Laravel 5.4
I need to add an Admin Panel over this existing project, but from what I see, there are quite few options for that.
One option is AdminLTE, but documentation on installing over existing project is very undetailed.
It also requires me to delete default Laravel Auth Controller, which is really not an option for me, because I've done a lot of changes in it.
Can you please recommend any admin panel that would be easy to install on existing project ?
Or should I write it myself ? But I'm not sure I can handle it.
i can recommend you a voyager package for laravel 5
step:1 composer require tcg/voyager
step:2 set up your .env file
step:3 put following 2 line in your app.php
TCG\Voyager\VoyagerServiceProvider::class,
Intervention\Image\ImageServiceProvider::class,
step:4 php artisan voyager:install
step:5 run your migration -> php artisan migrate
and then go to
localhost:8000/admin
or whatever your server is
Here I would recommend you to adopt a Laravel admin panel which I am using it already. That was the best Admin template which I've seen in recent days. Name of the product is Josh and available on Codecanyon.
Here is the link of the product where you can get it
https://codecanyon.net/item/josh-laravel-admin-template-front-end-crud/8754542?s_rank=9
You don't even need to follow the installation instruction provided by AdminLTE. As its a frontend template, just copy the css and js files of AdminLTE to your Laravel's public folder. Then take the html pages that you need from AdminLTE. You need to update the css and js links of that html with the new path of those file in your Laravel(use asset method).
Supposition: You are with Laravel 5.4
Add admin-lte Laravel package with:
composer require "acacha/admin-lte-template-laravel:4.*"
To register the Service Provider edit config/app.php file and add to providers array:
Acacha AdminLTE template provider
Acacha\AdminLTETemplateLaravel\Providers\AdminLTETemplateServiceProvider::class,
To Register Alias edit config/app.php file and add to alias array:
Acacha AdminLTE template alias
'AdminLTE' => Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::class,
Finally Publish files with:
php artisan vendor:publish --tag=adminlte --force
Use force to overwrite Laravel Scaffolding packages. That's all! Open the Laravel project in your browser or homestead machine and enjoy!
Related
I have tried to install telescope according to Jeffrey's video.
I am using the latest version of laravel. I have installed according to the laravel documentation for installing as dev.
But, don't get the file config/telescope.php and app\Providers\TelescopeServiceProviders.php in config folder.
Need to mention:
--I have used use Laravel\Telescope\TelescopeServiceProvider namespace in AppServiceProvider.php
I created a fresh laravel 5.3 project inside my xampp localhost environment. I went to the home page and it appeared as usual, with the pretty styles and all. But there is the new artisan command make:auth that sets-up a functioning registration system. But when I go to the register or login page, it should appear with the pretty styles, but instead it's appearing like this:
Any help?
I had the same problem. In my case I noticed that my app.css was empty. Solved it by using the following commands:
php artisan auth vue
npm install
npm run dev
Reference that I used for this problem with Laravel 6: Laravel 6.0 app.js only has require('.bootstrap');?
Try this
-Make sure that you are extending the master layout file(the default or your custom one)
-changes links like this
<link rel="stylesheet" type="text/css" href="{{asset('css/mycss')">
Share more code please if this did not work (folder structure , register.php)
I am making a package for Laravel 5 that will use bootstrap 3 and jquery.
How to include these assets in my package properly?
What if a person who will use my package will already have bootstrap and jquery in his/her project? Is it necessary to check that?
I can put them in my folder assets of the package, but what if these assets are in the project already?
You can not check if the project already has these assets, but if you want to include your own as part of the package you can do so with a provider.
Make a provider and register it in config/app.php (if your package doesn't have one already) and inside the boot() method you can "publish" (copy) assets from your package folder into the public folder of the Laravel application.
$this->publishes( [
realpath( base_path( 'your/package/folder/with/assets' ) ) => public_path( 'desired/folder/in/public' )
], 'public' );
If you are using default files without any modifications. then it is better to use from online repository, As keeping it public may override users custom settings. and it is wise to keep the package as small as possible.
And also you cannot check the whole project of user for these files
I have structured my app as the following
note: "MyCMS" is a folder inside the "app" directory of laravel root directory
http://paste.laravel.com/POt
the problem is that whenever i try to access the route "admin/users"
i get the following error
Class \MyCMS\Admin\UserController does not exist
any ideas where the problem might be ?
In your UserController.php, it should be
namespace MyCMS\Admin\Controllers; not namespace MyCMS\Admin;
And a side note, I don't think you can just call $this->package('MyCMS/Admin'); when it's in your app directory. If you look into laravel's source code for the package method, it's actually guessing the path for your "package" and going two levels up to get the resources. It's a very specific file structure.
sometime we face this issue then we should use <?php instead of <? in UserController.php
Then use composer du or composer dump-autoload
The reason for your issues is quite simple. Packages don't go in the app directory of Laravel.
If you want to create a package, do so with the following command:
php artisan workbench vendor/package --resources
This will then create a workbench folder in your Laravel installation, where a pre-defined directory structure will be at the ready for your newly created package.
/src
/Vendor
/Package
PackageServiceProvider.php
/config
/lang
/migrations
/views
/tests
/public
You may then register the provider by adding it to the providers array in the app/config/app.php file. After a composer dump-autoload your package should be ready to use in your app.
See this section in Laravel's documentation on how to create packages properly.
The Yii2 preview was recently released and is available on github. I want to take it for a test drive, but the "documentation" so far gets outdated almost instantly since it is still under heavy development. I have tried to follow this guide on creating a simple CRUD app with Yii2, but it fails at the step:
php yiic.php app/create /var/www/yii2
With the error:
Could not open input file: yiic.php
Indicating that there is no file called yiic.php. The only folder within the framework folder is yii (framework/yii), and within that folder there is no file yiic.php, only Yii.php which when called in the command line gives the command list:
The following commands are available:
- asset
- cache
- help
- message
- migrate
Anyone managed to successfully setup a Yii2 app? Care to share how you got it done?
Seems like yiic has been removed for now, there are alternatives though, so read on.
It's all in the early stages, so the following method could break in the coming days/weeks/months. Therefore use with caution.
There are 2 ways to do this now:
Use composer. (I recommend this option.)
Directly copy the contents of yii2/apps/ directory to your apps directory, depending on the type of app you want to try.
There are currently 2 options for type of app - advanced, and basic. Both are in their respective directories within the yii2/apps/ directory, i.e yii2/apps/advanced and yii2/apps/basic.
For basic go through the basic readme.md, and for advanced go through the advanced readme.md.
The directions for using composer are given in the respective readme.md files. Including them here for completeness:
Basic app:
Install composer, if you don't have it.
Use composer to install the app alongwith dependencies(Yii):
php path/to/composer.phar create-project --stability=dev yiisoft/yii2-app-basic my_yii2_trial
Access app from http://localhost/my_yii2_trial/www
Advanced app:
Install composer, if you don't have it.
Use composer to install the app alongwith dependencies(Yii):
php path/to/composer.phar create-project --stability=dev yiisoft/yii2-app-advanced my_yii2_trial
According to readme, after step 2 app should be accessible, but composer was failing(see issue 439). With schmunk's tip, ran the install or install.bat command that gets copied by composer: ./install . Selected development environment (by entering choice 0 in the instructions that show up when running install command). Update: The command has been renamed to init, composer doesn't fail anymore, with fix from Qiang (check the issue 439 for more details).
Access app at: http://localhost/my_yii2_trial/frontend/www or http://localhost/my_yii2_trial/backstage/www
Here's how to copy the directory and get it working:
Basic app:
create your web-accessible directory for the app : my_yii2_trial
copy all files and folders from yii2/apps/basic/ directory to my_yii2_trial/ directory.
modify the my_yii2_trial/www/index.php file to point to the correct path for Yii.php.
For me it was within yii2/framework/yii/
comment the line that tries to include ../vendor/autoload.php file, I couldn't find that file anywhere, so its probably for some future use. it is the autoloader provided by composer.
Access from browser : http://localhost/my_yii2_trial/www
Advanced app:
create your web-accessible directory for the app : my_yii2_trial
copy all files and folders from yii2/apps/advanced/ directory to my_yii2_trial/ directory.
modify the my_yii2_trial/frontend/www/index.php file to point to the correct path for Yii.php. Similarly modify backstage/www/index.php.
comment the line that tries to include ../vendor/autoload.php file in both the index.php of backstage and frontend.
Access app at: http://localhost/my_yii2_trial/frontend/www or http://localhost/my_yii2_trial/backstage/www
Some important links to read more about this: issue 77, issue 108, issue 131, and wiki comment.
I am not sure how composer's autoloader is being used, so can't comment on that. Also in future versions, backstage might be renamed to backend.