Laravel blade - double echo statement - laravel

I am already inside a {!! !!}
{!! do_shortcode('[searchandfilter id="27"]') !!}
I am now passing data to this partial file, and need to update that id=""
My thought was to add: {{ }} however it's not printing out because I am already inside of the {!! !!}.
{!! do_shortcode('[searchandfilter id="{{ $form_id }}"]') !!}
Any idea how to concatenate this $form_id inside this blade echo?

Solved it, forgot to try the regular concatenation method:
{!! do_shortcode('[searchandfilter id="'. $form_id .'"]') !!}

Actually, the issue is that you used simple quotes ''. PHP doesn't parse PHP variables inside those.
The following options should work:
{!! do_shortcode("[searchandfilter id='{$form_id}']") !!}
or
{!! do_shortcode("[searchandfilter id='$form_id']") !!}

Related

illegal string offset 'name' when working with password fields laravel 5.4

I'm having a problem. I create form by laravel. I'm working with text field succesfully but when working with password field = error. Who help me? Thank guys.
{!! Form::open() !!}
{!! Form::label('name','Username') !!}
{!! Form::text('txtname','',array('class'=>'user')) !!}
{!! Form::label('pass','Password') !!}
{!! Form::password('txtpass','',array('class'=>'user')) !!}
{!! Form::close() !!}
Form Password does not have value parameter. So the correct form is:
{!! Form::password('txtpass', array('class'=>'user')) !!}
Please Change the Line of password Field to this
{!! Form::password('txtpass',array('class'=>'user')) !!}

laravelcollective/html not finding any of my controllers

I am getting this error from a login page
Action App\Http\Controllers\Admin\LoginController#authenticate not defined. (View: /Applications/XAMPP/xamppfiles/htdocs/lectureme/resources/views/admin/login.blade.php)
I know for certain that this controller exists though, so why is it unable to find it? I have also created a new controller in the controller root and named it TestController, and tried routing to that instead, but that was also apparently not found.
Any suggestions for how to get access to the controller? Form code:
{!! Form::open(['action' => 'LoginController#authenticate']) !!}
<div class="form-group">
<div class="form-group">
{!! Form::label('username', 'Username:') !!}
{!! Form::text('username', null, ['class'=>'form-control']) !!}
</div>
<div class="form-group">
{!! Form::label('email', 'Email Address:') !!}
{!! Form::text('email', null, ['class'=>'form-control']) !!}
</div>
</div>
<div class="form-group">
{!! Form::submit('Login', ['class'=>'btn btn-primary']) !!}
</div>
{!! Form::close() !!}
I have also tried composer dump-autoload and php artisan cache:clear
Make sure you namespaced your controller properly. Assuming you have placed your controller in the App\Http\Controllers\Admin directory it would be:
namespace App\Http\Controllers\Admin

not show image in Laravel 5.2

I am using laravel5.2 but after using this code:
{!! Html::image(asset('/images/t1.png'),'',['class'=>'img-rounded']) !!}
The image is not shown.
You can try:
{!! Html::image(asset('/dist/images/t1.png'), '', ['class'=>'img-rounded']) !!}
Try this
{!! Html::image(url('/dist/images/t1.png'),'',['class'=>'img-rounded']) !!}
or
{!! Html::image(URL::asset('/dist/images/t1.png'),'',['class'=>'img-rounded']) !!}

destroy method gives weird error after upgrade to Laravel 5

I had this thing working well in Laravel 4.
{!! Form::open(['method'=>'delete','action'=>['ActionsController#destroy',$o->id]]) !!}
<button type="submit" class="fa fa-remove"></button>
{!! Form::close() !!}
Now I get this error:
Action Barryvdh\TranslationManager\ActionsController#destroy not defined. (View:....
I use this route to resource, which works well for creating, editing and viewing models.
Route::resource('actions', 'ActionsController');
Can you please help me out? I have no clue how to resolve this classess problem.
Worst part of the whole L5.
I thied to follow another advice from this question
Route::get('actions/{id}/destroy',['as'=>'actions.destroy','uses'=>'ActionsController#destroy']);
{!! Form::open(['method'=>'delete','action'=>'actions/'.$o->id.'/destroy']) !!}
But I still see this:
Action Barryvdh\TranslationManager\actions/23/destroy not defined.
try this:
{!! Form::open(['method'=>'delete','action'=>'actions'./$o->id) !!}
<button type="submit" class="fa fa-remove"></button>
{!! Form::close() !!}
the Delete method works:
/resource/{resource}

Laravel: Getting plain text while using Form class

I am a beginner of laravel. I have just installed "illuminate/html": "~5.0" with the help of link http://www.ekoim.com/blog/fix-class-form-html-not-found-laravel-5/
Now when I tried using of {{ Form::open() }} {{ Form::close() }} in view file. It is returning form in plain text format to browser.
<form method="POST" action="http://project.dev" accept-charset="UTF-8"><input name="_token" type="hidden" value="qNbi3DD1YGQncOv3PRBWl1l6BxVViWZnleVAmniS"></form>
I am attaching screenshot here.
Is there anything I forgot to do in order to this code to work?
Unlike Laravel 4, in Laravel 5 the content between {{ }} is now escaped by default. To output unescaped content you need to use {!! !!}. So in your case:
{!! Form::open() !!} {!! Form::close() !!}
Read more in the Laravel Templates Docs.

Resources