laravel-blade

Laravel 5.4 blade foreach loop

给你一囗甜甜゛ 提交于 2019-12-01 05:53:20
问题 I am building a venue manangement system, and on the landing page, i m trying to show all the available slots to the visitors. The ones that have already been booked are shown as not available. I have created two variables, one that carries the info from the time table and the other from the booking table and tyring to use blade to compare and show. This is how I am trying to implement it in blade: @foreach($times as $time) @foreach($bookings as $booking) <tr> @if($time->availble_times ==

Laravel Blade html image

亡梦爱人 提交于 2019-12-01 02:17:40
My image file path is public/img/logo.png and my app.blade.php file path is resources/views/app.blade.php Inside of my app.blade.php file I use {{HTML::image('/img/stuvi-logo.png')}} to display an image. I don't understand why this won't find the image. What is the root folder of the image() method? Change /img/stuvi-logo.png to img/stuvi-logo.png {{ HTML::image('img/stuvi-logo.png', 'alt text', array('class' => 'css-class')) }} Which produces the following HTML . <img src="http://your.url/img/stuvi-logo.png" class="css-class" alt="alt text"> If you use bootstrap, you might use this - <img src

Right way to build a link in laravel 5.3

一笑奈何 提交于 2019-12-01 00:42:29
Im trying to build a dynamic link with a view page (blade) with Laravel 5.3. My approach is: <a href=" {{ URL::to('articles') }}/{{ $article->id}}/edit">Edit></a> that will output the right url with my base url and some other slug: http://mydomain/articles/23/edit Where "23" is my article's id. This works but I wonder if there is a cleaner way to do that? many thanks You can use named routes for this // Your route file URL::get('articles/{articleId}/edit', 'ArticlesController@edit')->name('articles.edit'); //Your view <a href="{{ URL::route('articles.edit', $article->id) }}">Edit</a> Much more

Displaying laravel stored images on shared hosting

瘦欲@ 提交于 2019-11-30 16:26:12
I have successfully deployed my first laravel application on a live server. Everything looks great except the fact that I am unable to display the images that are being uploaded to the /myproject_src/storage/app/public/myfolder1 folder. Here is my folder hierarchy on HostGator: /myproject_src/ Here are all the laravel source files (except the public folder) /public_html/mydomain.com/ Here goes all my contents of the public directory I am storing the file path into the database in the following manner: public/myfolder1/FxEj1V1neYrc7CVUYjlcYZCUf4YnC84Z3cwaMjVX.png This path is associated with

How to use React js in blade template

人盡茶涼 提交于 2019-11-30 16:01:01
问题 I would like to use React js as a front-end for my laravel project . So i did the preset with: php artisan preset react Now i would like to know, how react component should be implemented in my blade views so they can access data passed to those views via controllers... For exemple, in my homeController i pass some data: return views('theview')->with('datas',$datas); In theview.blade.php i can access them like this: {{ $datas }} but how can i use this to update react component? 回答1: One of

Load Blade assets with https in Laravel

落花浮王杯 提交于 2019-11-30 10:56:46
问题 I am loading my css using this format: <link href="{{ asset('assets/mdi/css/materialdesignicons.min.css') }}" media="all" rel="stylesheet" type="text/css" /> and it loads fine for all http requests But when I load my login page with SSL (https), I get a ...page... was loaded over HTTPS, but requested an insecure stylesheet 'http... Can someone please tell me how do I make blade load assets over https instead of http? Should I be trying to load the assets securely? Or is it not Blade's job?

How to pass a custom function to a Laravel Blade template?

主宰稳场 提交于 2019-11-30 03:46:00
I have a custom function and I want to pass it in a blade template. Here is the function: function trim_characters( $text, $length = 45, $append = '…' ) { $length = (int) $length; $text = trim( strip_tags( $text ) ); if ( strlen( $text ) > $length ) { $text = substr( $text, 0, $length + 1 ); $words = preg_split( "/[\s]| /", $text, -1, PREG_SPLIT_NO_EMPTY ); preg_match( "/[\s]| /", $text, $lastchar, 0, $length ); if ( empty( $lastchar ) ) array_pop( $words ); $text = implode( ' ', $words ) . $append; } return $text; } And the usage is like this: $string = "A VERY VERY LONG TEXT"; trim

Laravel blade check box

蹲街弑〆低调 提交于 2019-11-30 00:37:54
I want to set check-boxes state from database, so I write, {{ Form::checkbox('asap', null, $offer->asap) }} But if I want to set 'id' to the check-box like {{ Form::checkbox('asap', null, $offer->ASAP, array('id'=>'asap')) }} It always set my check-box state to true. (Before user select it) So question how set 'id' in blade check-boxes when check-box state is set before user select it? 3rd argument decides whether checkbox is checked or not. So probably $offer->ASAP (or $offer->asap is true (or not false or not null). If you want to to make checkbox unchecked either set it to false, or don't

POEdit doesn't extract string in HTML tags

◇◆丶佛笑我妖孽 提交于 2019-11-29 20:06:53
问题 I'm having a problem with Laravel's blade templating syntax. When having something like: <input placeholder="{{ __('My Tooltip') }}" /> that string won't be founded by POEdit. But on same file if I had this: <span>{{ __('My Tooltip') }}</span> that's OK. I've already added a new extractor with follow configs but the problem persists. Command: xgettext --language=Python --add-comments=TRANSLATORS: --force-po -o %o %C %K %F An item in keywords list: -k%k An item in input files list: %f Source

Displaying laravel stored images on shared hosting

懵懂的女人 提交于 2019-11-29 15:47:33
问题 I have successfully deployed my first laravel application on a live server. Everything looks great except the fact that I am unable to display the images that are being uploaded to the /myproject_src/storage/app/public/myfolder1 folder. Here is my folder hierarchy on HostGator: /myproject_src/ Here are all the laravel source files (except the public folder) /public_html/mydomain.com/ Here goes all my contents of the public directory I am storing the file path into the database in the