Ok, this is driving me mad. I'm trying to include forms functionalities with FormFacade with Laravel 5, but I keep getting this error:
Class 'Illuminate\Support\Facades\FormFacade' not found
I'll write down what I have done:
After laravel 5 installation, I added FormFacade to laravel.
Updated the app.php file with the following lines:
Providers:
'Illuminate\Html\HtmlServiceProvider',
Aliases:
'Form' => 'Illuminate\Support\Facades\FormFacade',
'Html' => 'Illuminate\Support\Facades\HtmlFacade',
Then, I checked my composer.json file:
"require": {
"laravel/framework": "5.0.*",
"illuminate/html": "~5.0"
},
Did a composer update
Checked if I actually downloaded the files
All of this is done, but still I cannot find whats going wrong. I searched for help but nothing seems to work.
Search effort:
Laracasts tutorial
Class 'Illuminate\Html\HtmlServiceProvider' not found Laravel 5
http://tutsnare.com/class-form-or-html-not-found-in-laravel-5/
Still no luck. Have I missed something?
PS: I'm running on windows.
Those aliases are wrong. You should use the facades from Illuminate\Html:
'Html' => 'Illuminate\Html\HtmlFacade',
'Form' => 'Illuminate\Html\FormFacade',
Related
I'am new to laravel, and this is my first question because I could not find a solution anywhere.
I implemented JWT-token somehow and it worked until I mess it up. Now when I type php artisan serve I get that error, or when I try to publish. I tried everything like in question --- Laravel 5.6.26 Error- Class 'Tymon\JWTAuth\Providers\LaravelServiceProvider' not found --- but it won't work.
When I add in composer.json "tymon/jwt-auth": "^0.5.12" I get an error class LaravelServiceProvider not found, and when I change it to "tymon/jwt-auth": "^1.0.0-beta.3" or "tymon/jwt-auth": "^1.0.0-rc.2" then I ger error JWTAuthServiceProvider not found. I also tried composer require illuminate/auth but it won't work. Can I get some help please.
I had this same issue and I solved it by executing these commands
composer require illuminate/auth
composer require tymon/jwt-auth:"^1.0.0-rc.2"
composer update
Then
php artisan vendor:publish --provider="Tymon\JWTAuth\Providers\JWTAuthServiceProvider"
You can safely remove from your app.php file
Tymon\JWTAuth\Providers\JWTAuthServiceProvider::class,
'JWTAuth' => Tymon\JWTAuth\Facades\JWTAuth::class,
'JWTFactory' => Tymon\JWTAuth\Facades\JWTFactory::class
You need to also add the alias to config/app.php like so:
'providers' => [
Tymon\JWTAuth\Providers\JWTAuthServiceProvider::class,
],
'aliases' = [
....
//other aliases
...
'JWTAuth' => Tymon\JWTAuth\Facades\JWTAuth::class,
'JWTFactory' => Tymon\JWTAuthFacades\JWTFactory::class`
]
and then include it at the top of the PHP file you want to use it in, like
use JWTAuth;
Try to delete config.php file from bootstrap/cache folder, it worked with me
I'm having trouble with importing a css style sheet located in public/css in a blade file located in resources/views/includes.
The code I used in the blade file is
{{ HTML::style('css/layout.css') }}
which didn't work. I also tried
{{ HTML::style('css/layout.css', array('media' => 'print')) }}
The error I get is Class 'HTML' not found
I followed the steps in this question, so
I added "laravelcollective/html": "5.4.16" in composer.json
run composer update
added in config/app.php
'providers' => [
Collective\Html\HtmlServiceProvider::class,
]
and
'aliases' => [
'Form' => Collective\Html\FormFacade::class,
'HTML' => Collective\Html\HtmlFacade::class,
]
Now the error I get is
Class 'Collective\Html\HtmlServiceProvider' not found
And I don't understand why, as I added it to app.php. Indeed, when I go to app.php and the line where I added Collective.., the "Html" is colored in red and when I hover over it it says
Undefined namespace Html
What should I do about it? All this laravel thing is getting confusing to me.
Apart from the fact that I don't know what to do with,
{{HTML::linkAction('MemberController#show', 'view', array($value->id))}}
i found nothing online regarding the arguments of "linkAction"
1:Remove "laravelcollective/html": "5.4.16" in composer.json and clean other config for this package in config/app.php.
2:Run composer update
3:Run composer require laravelcollective/html
4:Add 'Collective\Html\HtmlServiceProvider::class', in config/app.php (providers)
5:Add 'Form' => Collective\Html\FormFacade::class, and 'Html' => Collective\Html\HtmlFacade::class, in config/app.php (aliases)
6:In controller try use Html; and use Form;
If you get any other error please share composer.json and config/app.php.
I am using Laravel 5.1. I am following a tutorial that is made in Laravel 5. I am working with form but it's not working properly.
I'm facing this error:
FatalErrorException in 44a7f556a7d1beef3d09ba2ba2e3c7f0 line 7: Class 'form' not found
How do I fix this?
Update composer.json (require part)
"laravelcollective/html": "5.1.*"
Run command , to update
composer update
Add to providers array
Collective\Html\HtmlServiceProvider::class,
Add to aliases array
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
Class 'Illuminate\Html\HtmlServiceProvider' not found laravel 5.0
Simply follow 4 step
1) Go root directory find and edit composer.json - In that file write "illuminate/html": "^5.0" in require array.
2) Goto cmd and goto your folder directory and ** composer update **run this command
3) Next, add your new provider to the providers array of config/app.php:
'providers' => [
'Collective\Html\HtmlServiceProvider',
],
4) Finally, add two class aliases to the aliases array of config/app.php:
'aliases' => [
'Form' => 'Collective\Html\FormFacade',
'Html' => 'Collective\Html\HtmlFacade',
],
After all this finished
Restart your laravel server :-- php artisan serve --port=8880
Now you can use Any Html tag in your view blade
For me, it was a much stupider mistake that I was making (although the provided answer works perfectly for the real issue).
What I was doing was continually editing the wrong composer file. I had one composer file outside of my laravel directory that was obviously not going to make any difference in my application.
When I did all of the recommended updated to the real composer file, everything worked fine.
I have tried installing sentry in laravel 5 but it doesn't work. I would like to know if anyone has done it and how to do it.
Update: I used the instructions for Laravel 4.
I have this working.
There is no official support right now for Sentry in L5. They state this right on their website. They are working on it however.
Add the following to your composer.json file in the require section.
"cartalyst/sentry": "dev-feature/laravel-5",
"illuminate/html": "~5.0"
Add the following to the autoload section.
"app/Http/Controllers",
It should look something like:
"require": {
"laravel/framework": "5.0.*",
"cartalyst/sentry": "dev-feature/laravel-5",
"illuminate/html": "~5.0"
},
"require-dev": {
"phpunit/phpunit": "~4.0",
"phpspec/phpspec": "~2.1"
},
"autoload": {
"classmap": [
"database",
"app/Classes",
"app/Http/Controllers",
"app/Models"
(Presuming linux with no aliases) Run php composer.phar dump-autoload then php composer.phar update
Follow the instructions on the following page to convert your files from 4.2 to 5.0: http://laravel.com/docs/master/upgrade#upgrade-5.0
If you are using HTML Facade for FORMS then change {{{ }}} or {{ }} for the FORM's to {!! !!} because L5 escapes all output from {{{ }}} and {{ }}. If you want raw output you must use {!! !!}.
When you move your redirect check to the boot method as per the instructions in #4 then add the following to the top of the RouteServiceProvider.php
use Cartalyst\Sentry\Facades\Laravel\Sentry;
The boot method should look something like:
public function boot(Router $router)
{
parent::boot($router);
// Check if someone is already logged in
Route::filter('members_auth',function(){
//If already logged in go to dashboard or else login
if(!Sentry::check()){
return Redirect::to('/login');
}
});
//
}
UPDATE 02-26-15
Do not run the command php artisan optimize as it will break sentry. I could not figure out what was wrong after I ran this but thought it probably has to be with the compiled.php file so I ran php artisan optimize --force and that fixed whatever the issue was.
Hope it helps.
I haven't personally installed it, but I know it's compatible. https://medium.com/#Cartalyst/laravel-5-support-4c11e01c3337
The installation instructions do not have specific Laravel5 information though it should be identical to L4 pending you pull in the correct branch. Assuming you are using composer you can do this by requiring "cartalyst/sentry": "dev-feature/laravel-5" in your composer.json.
Follow the rest of the L4 installation (add to providers and aliases array) and information except remember app.php is no longer in app/config/app.php but in config/app.php
If things are still not working for you, be sure to update your question with at least some information...
bootstarpCms use both laravel5 and sentry ,so you can read the source code to learn .here https://github.com/BootstrapCMS/CMS
Try Sentinel: https://github.com/rydurham/Sentinel
add to composer
composer require rydurham/sentinel
In config/app.php
'providers' => array(
...
'Sentinel\SentinelServiceProvider',
...
)
In app/Http/Kernel.php
protected $routeMiddleware = [
// ..
'sentry.auth' => 'Sentinel\Middleware\SentryAuth',
'sentry.admin' => 'Sentinel\Middleware\SentryAdminAccess',
];
then
publish config:
php artisan sentinel:publish
run migrations:
php artisan migrate
run seeder:
php artisan db:seed --class=SentinelDatabaseSeeder
add home route in app/routes.php
Route::get('/', array('as' => 'home', function()
{
return View::make('home');
}));
all done, go to myapp.dev/login