laravel-blade

laravel blade creating url

你离开我真会死。 提交于 2020-05-26 08:55:46
问题 I have a simple problem, basically I am getting name of the website from database and create a link according to it's name. it looks like: @foreach ($websites as $website) <a class="websites" href=" {{ asset ($website->name )}}"> {{ asset ($website->name )}} </a> @endforeach Which gives for example: http://localhost/name Howver links needs to be like this: http://localhost/website/name how can I add /website into my URL using blade template in laravel? 回答1: Try this: {{ url('website/' .

How to fix Invalid request (Unsupported SSL request)

◇◆丶佛笑我妖孽 提交于 2020-05-10 10:30:28
问题 I'm setting up my laravel application and every time I run php artisan serve, it starts a laravel development serve at localhost:8000. Bu when i open the locahost link on the browser, it forces the http to https and logs invalid request (unsupported SSl request). What do you advise me to do to resolve this? I have tried forcing the HTTPS mod rewrite rule to http:// on the .htaccess file and it still persists. This is the command line C:\Users\topaz\cashurban>php artisan serve Laravel

Canonical url in laravel

折月煮酒 提交于 2020-03-05 06:05:51
问题 I'm using https://example.com version of url for my laravel built app site. I want <link rel="canonical" hreflang="en-us" href="https://www.upscaleadventures.com/" /> as my canonical tag {{url()->current()}} only gives the URL that I've setup as default. <link rel="canonical" hreflang="en-us" href="https://upscaleadventures.com/" /> version in my case. How do I print https://www.upscaleadventures.com/ version of url in Laravel 回答1: You may set APP_URL in your .env file to https://example.com,

Canonical url in laravel

不羁岁月 提交于 2020-03-05 06:05:41
问题 I'm using https://example.com version of url for my laravel built app site. I want <link rel="canonical" hreflang="en-us" href="https://www.upscaleadventures.com/" /> as my canonical tag {{url()->current()}} only gives the URL that I've setup as default. <link rel="canonical" hreflang="en-us" href="https://upscaleadventures.com/" /> version in my case. How do I print https://www.upscaleadventures.com/ version of url in Laravel 回答1: You may set APP_URL in your .env file to https://example.com,

Laravel 5.2: asset path not working on server

末鹿安然 提交于 2020-01-25 18:28:06
问题 My laravel 5.2 app unable to fetch the stylesheet from the public/css directory on the production server but can fetch stylesheets on the local machine! here is how I am linking my files: <link href="{{asset('css/clock.css')}}" rel="stylesheet" media="all" /> I also tried bunch of different ways: <link href="{{URL::asset('css/clock.css')}}" rel="stylesheet" media="all" /> OR: {{HTML::style('css/clock.css')}} but nothing worked on server! but it is not able to fetch the css! when I check the

Why laravel validation don't displaying errors

↘锁芯ラ 提交于 2020-01-24 20:30:08
问题 I'm trying to validate a request from form and appear a problem, not showing error messages on the view. The validation succeeds, refreshing the view but not displaying errors. Apparently $errors is always empty I tested it on fresh installation. Laravel Version: 5.8.33 PHP Version: 7.3.8 Database Driver & Version: mysql 5.7.22 Form is this @section('content') @if ($errors->any()) <div class="alert alert-danger"> <ul> @foreach ($errors->all() as $message) <li>{{ $message }}</li> @endforeach <

Checking which `guard` is loggedin

给你一囗甜甜゛ 提交于 2020-01-21 02:44:26
问题 I have a multiauth laravel 5.2 app, with the fallowing guards defined on config/auth.php : ... 'admin' => [ 'driver' => 'session', 'provider' => 'admin', ], 'user' => [ 'driver' => 'session', 'provider' => 'user', ], ... So, admin and user . The problem resides in the view layer, since this two loggedin guards share some views, ex: Hello {{Auth::guard('admin')->user()->name}} In this case the guard is hardcoded into the view to be always admin (it gives error when loggedin guard is user ),

Let users create custom blade layouts / store in database

Deadly 提交于 2020-01-14 05:28:26
问题 Problem : I need to let my web-app users create their own blade layout templates . So the most convenient solution is to store the blade templates into the database. However, I see no method to extend a child view from a layout code NOT SPECIFIED in a blade file . Furthermore the next concern is security. I can't rely on users to insert safe code . Giving access to insert php code or directly blade code is disastrous for the system. So how to? Save the layout template in database Make sure no

Laravel 5.2: retrieving a cookie via blade returns null also if cookie is set

落爺英雄遲暮 提交于 2020-01-13 10:12:20
问题 I set a cookie my_cookie via Javascript function createCookie(name, value, days) { var expires; if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); expires = "; expires="+date.toUTCString(); } else { expires = ""; } document.cookie = name+"="+value+expires+"; path=/"; } .... createCookie('my_cookie', 1, 365); .... Via Chrome Cookie Inspector I see that the cookie is created with value 1. Via Laravel Blade I tried: @if (Cookie::get('my_cookie') !== null) // or

Blade if condition in controller function

梦想与她 提交于 2020-01-07 02:38:08
问题 Is it possible to use blade @if conditions in functions of controller. This is my function of PublicController public function tourBanner($country){ @if( $country == 'country1') background-image:url({{ asset('images/inside8.jpg') }}); @elseif ( $country == 'country2') background-image:url({{ asset('images/inside7.jpg') }}); @elseif ( $country == 'country3') background-image:url({{ asset('images/inside5.jpg') }}); @elseif ( $country == 'country4') background-image:url({{ asset('images/inside6