Class Html not found error in laravel 5 - laravel

I add these packages in my laravel composer.json:
"laravelcollective/html": "~5.0"
and i add these
'Collective\Html\HtmlServiceProvider',
in providers and these
'Form'=> 'Collective\Html\FormFacade','Html=>'Collective\Html\HtmlFacade',
in aliases..
But i cant make change like this in my HTML file {{ html::style('/css/AdminLTE.min.css') }} its show HTML Class Not Found.
i checked in tinker
>>> Form::text('foo')
=> "<input name=\"foo\" type=\"text\">"
but its working..any help??

Html and Form classes were deprecated from Laravel 5. You can access similar functionality using Laravel Collective.

You have a typo error. Try this:
{{ Html::style('/css/AdminLTE.min.css') }}

Check this link, or try this:
Add this in composer.json require section
"illuminate/html": "5.*"
and run composer update.
Open your config/app.php
add under 'providers' array add this
Illuminate\Html\HtmlServiceProvider::class,
add under 'aliases' array add this
'Form' => Illuminate\Html\FormFacade::class,
'Html' => Illuminate\Html\HtmlFacade::class,
and under your blade templates, use like this
{!! Html::image('uploads/zami.jpg') !!}

Related

Use Carbon Model on laravel blade the path error

when I use the carbon on my blade
localhost:8000/todo.blade.php
I use
{{ Carbon::parse($chunk->time)->diffForHumans()}}
But when I use the cabon on my blade
localhost:8000/todo/todolist.blade.php
I must use
{{ Carbon\Carbon::parse($chunk->time)->diffForHumans()}}
why the url is different and how can I use the same code on the any location
just like
{{ Carbon::parse($chunk->time)->diffForHumans()}}
Or can I use some code like asset()??
{{ asset(Carbon::parse($chunk->time)->diffForHumans())}}
If you want use {{ Carbon::parse($chunk->time)->diffForHumans()}} in any location you need register Class Aliases. Go to config\app.php and add to existing aliases new one:
'aliases' => [
//...other aliases
'Carbon' => \Carbon\Carbon::class
];
Now you can use Carbon instead of \Carbon\Carbon everywhere.

Vue Directive on Laravel Collective Html Form

How do I use a vue.js directive on a form object created using laravel collectives library.
ex: {{Form::open(['route' => 'route.name'])}}
How would I add v-mydirective to the <form> tag?
You can add extra attributes to the array
{{Form::open([
'route' => 'route.name',
'v-if' => 'foo'
])}}

Laravel - laracasts/PHP-Vars-To-Js-Transformer

I'm trying to get this package to work: https://github.com/laracasts/PHP-Vars-To-Js-Transformer
I did everything according to the description, but I get no output of the variables.
Laravel Version: laravel/framework (v5.2.24)
My config/app
Laracasts\Utilities\JavaScript\JavaScriptServiceProvider::class,
'JavaScript' => Laracasts\Utilities\JavaScript\JavaScriptFacade::class,
My config/javascript
'bind_js_vars_to_this_view' => 'footer',
'js_namespace' => 'qwerTEST'
in my controller
use JavaScript;
JavaScript::put(['fett' => 'testtesttest']);
in my main view
#include('layouts.footer');
my footer.blade.php
`<div>some text</div>`
and in my view
#extends('layouts.intern')
#section('content')
<script>
console.log('test');
console.log(qwerTEST.fett);
</script>
#endsection
the javascript of chrome gives out
test
Uncaught ReferenceError: qwerTEST is not defined
And there is nothing with qwerTEST javascript namespace in the sourcecode. But I get no error at all.
Am I missing something?
I found it:
in my config/javascript I have to write the full path to the view:
'bind_js_vars_to_this_view' => 'folder.footer'
Could be better described in the Package..

Laravel 5.1 - barryvdh/laravel-dompdf PDF Generation Error

In my composer:
"barryvdh/laravel-dompdf": "0.6.*",
Here is My config/app Setup:
Providers Array: 'Barryvdh\DomPDF\ServiceProvider',
Aliases Array: 'PDF' => 'Barryvdh\DomPDF\Facade',
Here is My route Setup:
$pdf = App::make('dompdf.wrapper');
Route::get('/dompdf', function() {
$html='<p>Foo Bar</p>';
PDF::loadHTML($html)->setPaper('a4')
->setOrientation('landscape')
->setWarnings(false)
->save('myfile.pdf');
});
While I hit /dompdf url. I got this Error.
My another Question is if I want to use DOM PDF library in My Controller Method. What setup or Step I Need To Follow??
You can run the below command and try
composer require barryvdh/laravel-dompdf

Laravel 4 Javascript Link using {{Html}}

Is there any Laravel4 Html() function or way to add a disabled link. Of course I could create the <a> tag directly, though I'd prefer to be consistent.
ie:
{{ Html::link('javascript:;','Delete',array('id'=>"deletebt")) }}
You must use link_to, for example :
link_to('link', 'title', array('id' => 'MyId'));

Resources