Why Larecipe can't load correctly? - php

I installed Larecipe in the project and he can't load correctly. When i see "/docs/1.0/overview", get errors in console and layout can't be load.
Uncaught ReferenceError: CreateLarecipe is not defined
Uncaught ReferenceError: LaRecipe is not defined
I made package updates and unfortunately it did not help.
Laravel Framework 5.7.28
"binarytorch/larecipe": "^2.1",

This may be an issue with the LaRecipe service provider not being registered (or auto-registered).
Add the service provider to the providers array in config/app.php:
'providers' => [
// Other Service Providers
BinaryTorch\LaRecipe\LaRecipeServiceProvider::class,
],

I experienced the same thing.
Try running both these Artisan commands:
php artisan larecipe:install
php artisan vendor:publish --tag=larecipe_assets --force

Please try this. I think you have to recreate boostrap/cache/compiled.php file.
php artisan optimize

Related

Laravel Passport migrations not using default connection

I am updating an application for my organization from Laravel 5.4 to 8.8. One of the packages we're using is an OAuth2 implementation that is replaced with laravel/passport - so I'm trying to get that package working.
Following the directions here: https://laravel.com/docs/8.x/passport#installation, I've installed laravel/passport, and want to apply the migrations. Running php artisan migrate gives me an error saying "Database connection [mysql] not configured".
That's odd, because the default configured database connection is "uoda".
I have tried:
In config/database.php, duplicating the connection details for uoda to mysql.
Renaming uoda to mysql and changing the default connection to "mysql"
Creating a new config/passport.php file that looks like:
return [
'storage' => [
'database' => [
'connection' => 'uoda'
]
]
];
but this file isn't even being called.
Going into vendor/laravel/passport/config/passport.php and changing "storage.database.connection" to env('DB_CONNECTION', 'uoda'). I changed this back to mysql after renaming the 'uoda' connection as mentioned above.
After each of these I call php artisan cache:clear.
Nothing I do seems to cause the migration to use the actually configured connection properties. What am I missing?
Please ELI5 your responses - this is my first foray into Laravel so I know next to nothing about its intricacies.
Thanks.
I was missing an evidently important command:
php artisan config:clear

Why am I getting a "Class 'App\Providers\Form' not found" error in Laravel 5.5.43?

I did a Laravel 5.5.43 installation this morning with the following Composer command:
composer create-project laravel/laravel project-name
I then ran the following command in the project folder to install Laravel Collective:
composer require "laravelcollective/html":"^5.4.0"
I then added the following under providers in config/app.php:
Collective\Html\HtmlServiceProvider::class,
And I added the following under aliases in config/app.php:
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
After that, I wanted to create custom form components, so I ran the following Artisan command:
php artisan make:provider FormServiceProvider
And in that new provider file, I added the following line to the boot method:
Form::component('customText', 'components.form.text', ['name', 'value' => null, 'attributes' => []]);
Lastly, I added the following to providers in config/app.php:
App\Providers\FormServiceProvider::class,
When I do that though and refresh the Laravel instance from the browser, I get the following error:
Class 'App\Providers\Form' not found
However, if I add the following at the top of the FormServiceProvider.php file, then it works:
use Collective\Html\FormFacade AS Form;
I understand the concept of namespaces and why that makes the Form::component method in the boot method in the file properly work, but what I don't get is why I need to add that use line to the file at all.
Isn't the 'Form' => Collective\Html\FormFacade::class, line in the aliases array in the app.php file supposed to do that for me so I don't need to add the use line to the FormServiceProvider.php at all? What am I missing / doing wrong / not understanding?
Thank you.
I probably should just delete this question, but the simple answer was to add the following at the top of the FormServiceProvider.php file:
use Form;
Thanks.
Run below command:
php artisan config:cache
php artisan cache:clear

Class 'Datatables' not found Laravel 5.4

I am using laravel 5.4 and php version is 5.6.
I am getting error "Class 'Datatables' not found". I am following standard procedure. I have installed datatable using composer by following command:
composer require yajra/laravel-datatables-oracle:"~7.0"
I added these two lines in config->app file in service provider and aliases:
Yajra\DataTables\DataTablesServiceProvider::class,
'DataTables' => Yajra\DataTables\Facades\DataTables::class,
then publish package :
php artisan vendor:publish --provider=Yajra\DataTables\DataTablesServiceProvider
I am using raw query here is my controller code :
function allvendor(){
$sql="my query";
$results=DB::table(DB::raw("($sql)"));
return Datatables::of($results)->make(true);
}
It's a typo. You set alias as DataTables but returned is Datatables.

localhost:8000 keeps on loading without any error or proper output

I am only learning laravel, and i am unable to load my laravel homepage on localhost:8000, from i long time it was going fine, but today i updated my composer and updated entry of :
config/app.php
in aliases::
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
in providers::
Collective\Html\HtmlServiceProvider::class,
and composer.jason file:
in require::
"laravelcollective/html": "~5.0"
now,
localhost:8000 is causing errors. It is not showing any error but it just continues to load.
I think this issue is with clearing cache. You can run following command to clear cache:
php artisan config:cache
php artisan config:clear
php artisan cache:clear
Hope this answer will help you well!
create .env file(copy from .env.example) and set
APP_DEBUG=true
APP_LOG_LEVEL=debug
Try to clean your access.log and error.log files in your Apache server logs folder (mine is here: c:\Apache\Apache2.2\logs\)

How to add correctly a new service provider in L5?

I've found this page :
https://gist.github.com/rtconner/40b415073378da28b2bf
where it's shown a Service provider to be added in L5 in order to manage sftp connection driver in filesystem configs. Which is supposed to solve a issue.
Anyway once I executed via console:
php artisan make:provider SftpServiceProvider
And edited the SftpServiceProvider class as shown in the above webpage.
I went to config/app.php to add
'providers' => [
...
'App\Providers\SftpServiceProvider',
...
]
I tried a
composer dump-autoload --optimize (with and without the option)
But always I get a error:
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'App\Providers\SftpServiceProvider' not found
In fact, I cannot see in my vendor/composer/autoload_classmap.php
the line addressing to SftpServiceProvider
Also executing a
composer update #will not be ok.
Again the errors:
- Script php artisan clear-compiled handling the post-update-cmd event returned with an error
- [RuntimeException] Error Output: PHP Fatal error: Class 'App\Providers\SftpServiceProvider' not found
What do I miss in the ServiceProvider creation procedure?
Thanks

Categories