I'm trying to add a github author's reference system project to my project. I did everything but stuck on the last step. He gave me the code to get the reference link, but I don't know where or in which file to add it.
Here GitHub link: https://github.com/questocat/laravel-referral
step where i got stuck and don't know where to add;
$user = App\User::findOrFail(1);
{{ $user->getReferralLink() }}
I tried doing
<p>{{ $user->getReferralLink() }} </p>
on a sample page, but it didn't work. I would be glad if you help.
Related
I makes website by laravel as multi language
and I make full switches to change the language and it work as the flowing code
<?php
return [
'home_menu'=>'home',
'about_menu'=>'about',
'contact_menu'=>'contact',
'message'=>'<h1> welcoome</h1>',
];
Now I need to show text from contact.blade.php from resource/views Instead of
welcoome.
There are many ways you can show your translations in Laravel
{{ trans(filename.arrayIndex) }}
#lang(filename.arrayIndex)
and in case you have html in your translations then
{!! trans(filename.arrayIndex) !!}
I hope this will help you but you must check all the Laravel documentation before starting the project. It will really help you understanding the Lara Concept better
hi sorry for my language.
im using laravel 5.6 to create a simple article site.
i have a problem with show article comments as string. the problem is : laravel try to render php codes and the page give me some errors.
imagine a user wants to send his laravel code as comment to me:
(this is just an example)
#foreach($article->tags as $tag)
<a class="tags" href="/tags/{{ $tag->slug }}">{{ $tag->title }}</a>
#endforeach
if user send this codes as comment to me, my page not loading and give me errors
my code to show comments :
{!!$comment->body !!}
help me please . thank you
Replace {!!$comment->body !!} with {{$comment->body }}.
When you use {!! !!}}, the template engine tries to parse the contents within the braces. Use {{ }} so that the contents are displayed as it is escaping all html.
i found the problem :
problem is for laravel blade codes.
like: #foreach . #if . #auth and ....
i have to scape this codes with space :
# foreach . # if and ....
i'm displaying external Website Links from my Users in a Profile Page. The URL Format is: www.xyz.com. When i put a http:// before the {{ url }} Laravel changes the Protocoll automatically to https://. In the Result a lot of the Websites don't open properly. I set the APP_URL in the .env File to
https://domain because i want to use SSL in the App.
Laravel (Blade) is removing the http:// from the URL when i just want to print the Variable too. Even when i put http:// right in front the URL in the DB (MySQL) i still have the same problem.
All i do in the Controller is:
$user = \App\User::find($id);
After 2 days of research i'm reaching out to the community. Basically i'm searching for something like secure_url() inverse.
What i tried:
{{ url('http://'.$url) }}
{!! url('http://'.$url) !!}
{!! url(e('http://'.$url)) !!}
<a href="http://{{ $url }}">
{{ $url }}
Putting the Protocoll right in the DB
What do i not get here? Thank you for any help.
EDIT
Laravel does this only when i visit my site over https.
UPDATE & SOLUTION
It was the problem of the Laravel Cache Speed Package. I deactivated it and everything was back to normal. My fault, my bad.
I'm using Wordpress with the "Advanced Custom Fields" plugin, and I'm trying to call variables from the plugin into my TWIG file.
The documentation for the plugin says to use <?php the_field('field_name'); ?> in the PHP, but I can't figure out how to translate that code to TWIG.
I tried the following:
Running code as is (but it appears TWIG doesn't run pure PHP.)
{% post.the_field('my_fields_name') %}, but to no avail
{{ post.my_fields_name }}, but it printed/logged "Array" to the frontend.
{{ post.get_field('the_field', my_fields_name) }} and
{{ post.get_field('the_field', 'my_fields_name') }}
Any help will be greatly appreciated
Took me a while, but ended up being an easy solution! Turns out these custom fields are stored in the meta-data, so all I had to do was {{ post.meta('my_fields_name') }}
I am new to Laravel so my problem is that I am trying to add multiple script files to my blade.php page using this code:
{{
HTML::script('js/bootstrap.min.js');
HTML::script('js/Chart.js');
}}
without any results , am I doing anything wrong or misunderstood some concept, please specify the best way to achieve my goal
only first include is working, the second one is not including
Thanks
You can't have line breaks inside Blade tags (at least not in Laravel 3). What you need to do is to add {{ ... }} for every HTML:: you have.
{{ HTML::script('js/bootstrap.min.js'); }}
{{ HTML::script('js/Chart.js'); }}