How to integrate Admin Lte theme in Laravel 5.4 - laravel

Need Help to integrate Admin Lte theme in la ravel 5.4 , i try to integrate it but it show black pages.

Download laravel project folder by using:
composer create-project --prefer-dist laravel/laravel laravelLTE
Create database named :laravel and make database related changes in .env file
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=null
Goto the folder path
/var/www/html$ cd laravelLTE
To run all of your outstanding migrations, execute the migrate Artisan command:
/var/www/html/laravelLTE$ php artisan migrate
In case of string error make changes in following page :
/var/www/html/laravel/app/Providers/AppServiceProvider.php
use Illuminate\Support\Facades\Schema;
public function boot()
{
Schema::defaultStringLength(191);
}
Inorder to install Admin Lte theme hit following commands in your terminal:
composer require "acacha/admin-lte-template-laravel:4.*"
composer update
To register the Service Provider edit the file
config/app.php
And add following line to providers array:
Acacha\AdminLTETemplateLaravel\Providers\AdminLTETemplateServiceProvider::class,
To Register Alias edit the file
config/app.php
And add following line to alias array:
'AdminLTE' => Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::class,
Get configuration file in your application from vendor package file.
/var/www/html/laravelLTE$ php artisan vendor:publish --tag=adminlte –force
/var/www/html/laravelLTE$ php artisan serve
thank you
I hope this will help you to integrate adminLTE theme

Related

iIlluminate/mail not available in artisan

I use Lumen7 (based on Laravel7) as framework for my projekt. I tried to install the mailer, but it doesn't work.
I did the following steps:
Installed illuminate/mail via composer require illuminate/mail:7
Added the following to bootstrap/app.php
$app->register(Illuminate\Mail\MailServiceProvider::class);
$app->configure('mail');
$app->alias('mail.manager', Illuminate\Mail\MailManager::class);
$app->alias('mail.manager', Illuminate\Contracts\Mail\Factory::class);
$app->alias('mailer', Illuminate\Mail\Mailer::class);
$app->alias('mailer', Illuminate\Contracts\Mail\Mailer::class);
$app->alias('mailer', Illuminate\Contracts\Mail\MailQueue::class);
Copied the mail.php from
https://github.com/laravel/laravel/blob/master/config/mail.php to
config/mail.php
Added the following to my .env
MAIL_MAILER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=hello#example.com
MAIL_FROM_NAME="Example app"
When I try to generate my mailable via php artisan make:mail MyMailable, then I get the following error: Command "make:mail" is not defined.
When I use php artisan, then I don't see mail in the command list of make, just the following make commands:
make
make:migration Create a new migration file
make:seeder Create a new seeder class
I have no idea what the issue is, hopefully someone can help me.
I think I've found a way to achieve this. Apparently Lumen needs another package installed to have all the Laravel methods. Simply add the composer package:
composer require flipbox/lumen-generator
And enable it in your bootstrap/app.php file:
$app->register(Flipbox\LumenGenerator\LumenGeneratorServiceProvider::class);
Afterwards your "php artisan" should return way more methods, also for "make:mail".

How to rename a project in Laravel 7

All results from searching the web offer to run the "php artisan app:name {newProjectName} but since Laravel 6 the app:name command has been removed. So what is the way to do it in Laravel 7?
You can rename your project editing the "app.php" at: /laravel-project/config/app.php
/*
|--------------------------------------------------------------------------
| Application Name
|--------------------------------------------------------------------------
|
| This value is the name of your application. This value is used when the
| framework needs to place the application's name in a notification or
| any other location as required by the application or its packages.
|
*/
'name' => env('APP_NAME', 'Laravel'), // "Here your new Project Name"]; ?>
Remove the env('APP_NAME','Laravel') and replace it for your new Project Name
It is recommended to remove the .env and use only the app.php file, or protect the .env file in your .htaccess if your project are in production, there is a possibility to be downloaded from the browser.
See screenshot of the app.php file
Additional Info
After this process please run the following command in your terminal:
php artisan optimize
php artisan config:clear
php artisan config:cache
Rename the App
If you just want to rename your Laravel App you can do so in the .env file and change the APP_NAME
Change the Namespace
Prior to version 6.0 the app:name command allowed to change the application namespace. This feature was removed however, you can read more about it here.
If you really need this feature, there is a community package for version 6, but none for version 7 that I could find.
Create New
From the docs:
laravel new blog
or
composer create-project --prefer-dist laravel/laravel blog
please change name form laravel to your app
'name' => env('APP_NAME', 'Laravel'),
or change config/app.php
'name' => env('APP_NAME', 'Laravel'),
and
php artisan config:cache

PHP artisan migration error

When i m executing PHP artisan migrate I'm getting following error
C:\xampp\htdocs\Social>php artisan migrate help
[ErrorException]
include(C:\xampp\htdocs\Social\vendor\composer/../../app/Http/Controllers/A
uth/AuthController.php): failed to open stream: No such file or
directory
C:\xampp\htdocs\Social>php artisan migrate
[ErrorException]
include(C:\xampp\htdocs\Social\vendor\composer/../../app/Http/Controllers/A
uth/AuthController.php): failed to open stream: No such file or
directory
C:\xampp\htdocs\Soci
how to solve this problem please help???
It looks like you're trying to use Laravel auth system by adding Auth::routes(); (Laravel 5.3+) or Route::auth(); (Laravel 5.2) to the routes file, but you didn't create controllers and views. So, you'll need to remove the line from the web.php and run this command:
php artisan make:auth
After that put Auth::routes(); back to the web.php. Or Route::auth(); to the routes.php if you're using Laravel 5.2 and lower.
https://laravel.com/docs/5.4/authentication#authentication-quickstart
Run composer install in your root project folder (or php composer.phar install)

Can not start laravel after trying to install library

I have web-app on Laravel and I tried to update yajra/datatables to last version, so it needed
'Maatwebsite\Excel\ExcelServiceProvider'
I tried composer update, so it didn't help.
Now I removed this line from composer.json
But on calling php artisan clear-compiled
It shows me an error:
PHP Fatal error: Class 'Maatwebsite\Excel\ExcelServiceProvider' not found in /var/www/html/talimger.xyz/vendor/laravel/framework/src/Illuminate/Foundation/Application.php on line 575
Show where I should remove this Maatwebsite files
`
The instructions at https://github.com/Maatwebsite/Laravel-Excel tell you what to do, but not how to do it. The assumption is that you already know a bit about composer.
Here's the 'how to do it'...
1) Remove the service provider entries you made and delete any lines you added to composer and then type the following:
composer require "maatwebsite/excel"
2) After updating composer, add the ServiceProvider to the providers array in config/app.php
Laravel 5.1:
'Maatwebsite\Excel\ExcelServiceProvider',
Laravel 5.2:
Maatwebsite\Excel\ExcelServiceProvider::class,
3) You can use the facade for shorter code. Add this to your aliases:
Laravel 5.1:
'Excel' => 'Maatwebsite\Excel\Facades\Excel',
Laravel 5.2:
'Excel' => Maatwebsite\Excel\Facades\Excel,::class
Comment out 'Maatwebsite\Excel\ExcelServiceProvider' from the providers array in app.php under config then run composer update when you are done then your uncomment it.

How to use artisan to make views in laravel 5.1

I have been looking in the docs for a solution to make views with basic CURD operations but without much success.
I guess this might be pretty simple, but am missing something or not looking hard enough.
i can make models and controllers using the below artisan commands
php artisan make:model modelName
php artisan make:controller controllerName
But how do we make the basic CURD views. something like
php artisan make:views
cant find any doc for this. Please help
At the time of writing, there isn't a way to create views via artisan without writing your own command or using a third party package. You could write your own as already suggested or use sven/artisan-view.
if you are using laravel 5.1 or 5.2 this gist can help you make:view command just create command copy and paste the code from gist.
Step 1:
php artisan make:command MakeViewCommand
Step 2:
copy class from this gist
https://gist.github.com/umefarooq/ebc617dbf88260db1448
Laravel officially doesn't have any Artisan cammands for views.
But you could add third party plugins like Artisan View
Here's the link Artisan View
After adding this plugin to your project by the guide provided here you should be able to perform following cammands :
Create a view 'index.blade.php' in the default directory
$ php artisan make:view index
Create a view 'index.blade.php' in a subdirectory ('pages')
$ php artisan make:view pages.index
Create a view with a different file extension ('index.html')
$ php artisan make:view index --extension=html
There is very easy way to create a view(blade) file with php artisan make:view {view-name} command using Laravel More Command Package.
First Install Laravel More Command
composer require theanik/laravel-more-command --dev
Then Run
php artisan make:view {view-name}
For example
It create index.blade.php in resource/views directory
php artisan make:view index
It create index.blade.php in resource/views/user directory
php artisan make:view user/index
Thank you.
In v5.4 you need to create the command with:
php artisan make:command MakeView
and before you can use it, it must be registered in App/Console/Kernel like
protected $commands = [
Commands\MakeView::class
];
then you make a view like: php artisan make:view posts/create
To create a view (blade) file through command in laravel 8:
composer require theanik/laravel-more-command --dev
php artisan make:view abc.blade.php
You can install sven/artisan-view package to make view from CMD, to install package write this command:
composer require sven/artisan-view --dev
After installing it, you can make a single view or folder with all views that contain {index-create-update-show}
To make a single file we using this command:
php artisan make:view Name_of_view
For example
php artisan make:view index
To make a folder that contain all resources index - create - update - show write name of folder that contain all this files for example:
php artisan make:view Name_of_Folder -r
For example:
php artisan make:view blog -r
-r is a shorthand for --resource you can write full name or shorthand to make resource.
you can extend yields from master page if master page inside in directory layouts we write command sith this format
php artisan make:view index --extends=layouts.master --with-yields
layouts is a directory this directory may be with a different name in your project the idea is name_of_folder/master_page that you want to extend yields from it.
For more view docs

Resources