Put one dinamic object with assets in laravel - image

Hi i dont know how put img with assets.
I have this
{{asset('Articulos/{{$Articulo->path}}')}}
but i have error
syntax error, unexpected '}'
can you help me?

The correct syntax is:
{{ asset('Articulos/' . $Articulo->path) }}

Related

How can I get better output from Artisan commands?

[Symfony\Component\Debug\Exception\FatalThrowableError] Parse
error: syntax error, unexpected 'protected' (T_PROTECTED)
That's all I get. Any chance of a class name? The line causing the error? Anything at all that would help me narrow this down?
You can check last record in /storage/logs/laravel.log file.
Also, you could use route for the command to display full exception message:
Route::get('test-my-command', function() {
Artisan::call('my:command');
});

Some favicons returning "Unable to init from given binary data." when using Intervention Image

I am using intervention image to save favicons from a url.
I have this working, but only for some URL's. For example:
This doesn't work: http://www.speedhunters.com/favicon.ico
But this does: http://www.slamsanctuary.com/favicon.ico
My code is (The providerIcon is from scraping the page content):
\Image::make($info->providerIcon)->save(public_path('/uploads/' . $faviconName));
The error returned is:
NotReadableException in Decoder.php line 96:
Unable to init from given binary data.
in Decoder.php line 96
at Decoder->initFromBinary('h( ###&&&'''222333555666999???AAAIIIJJJLLLNNNOOOaaaeeeooopppssszzz{{{���������������������������������������������������������������������������������������������������������7FHHD9(+HHHHHHHH#&FHHHHHHHHHH*#HHHH%)EHHF$GGGB /HHH-;HHH6.<FHHHH23HHHHHHHG0HHHHHHH?" AHHHH>/! AHHH,3HHH+CHHHEHHG:1=HHHG$FHHHHHHHH85EHHHHG4!'' ') in AbstractDecoder.php line 65
Any ideas why one works and one doesn't?
There must be something with $faviconName. Look at <input type="file" name="faviconName">

BadMethodCallException in Macroable.php line 74 : Method controller does not exist

I'm getting little bit issue when I follow Route Controller.
Web.php Code:
{"
Route::controller('/admin','adminController');
"}
adminController.php Code:
{"
<?php
namespace App\Http\Controllers;
class adminController extends Controller{
public function getDashboard(){
echo " Get Dashborad Method ";
}}
"}
When I hit http://localhost:8000/admin/dashboard
an error:
Display ("BadMethodCallException in Macroable.php line 74 : Method controller does not exist.")
Here is SnapShot:
Please take a look and let me know what is wrong with code.
Please also make sure you don't use any namespace inside your routes file.
E.g. If by mistake your IDE add's
use Illuminate\Routing\Route;
It could result in the same error mentioned above. Your route file (web.php or api.php) should not use the Illuminate\Routing\Route class.
EDIT:
Tested on Laravel 5.5
Faced the same problem recently. Laravel 5.3 does not support Route::controller() method. You need to change it to Route::get().
Please check how to use it here https://laravel.com/docs/5.3/routing#basic-routing.
I got this error while running artisan command. Finally, I solve by removing the,
use Illuminate\Routing\Route
in web.php file.
i have just solved this problem i was using
$table->int('TeachingGroup_id');
where i should use the full integer Not int only by solving this now migration done S

Use Twig variable in include path

I want to use a Twig variable in a include line, but it isn't working:
{% include 'folder/{{ component }}.twig' %}
I get the error:
Unable to find template "folder/{{ component }}.twig"
Can anyone help me out?
Thanks!
I just found the answer here:
https://groups.google.com/forum/#!topic/twig-users/zfnxC16gHx0
The correct syntax is:
{% include 'folder/' ~ component ~ '.twig' %}

smarty , how to solve smarty incompatible

unrecognized tag: $ncache['tab']="gallery_cat" (Smarty_Compiler.class.php, line 455)
i got this error, when i type the following code
{$ncache[tab]="gallery_cat"}
{$ncache.tab="gallery_cat"}
anyway to assign an array in smarty?
You can assign arrays in smarty with the php tag like this:
{php}
$this->assign("array", array('1','2','3'));
{/php}
Or if you are using version 3 you can also use it directly from smarty
{$array = ['1','2','3']}

Resources