laravel-blade

How to comment code in a vue.js file?

南楼画角 提交于 2019-12-03 04:10:17
I have the need to insert a comment inside a vue.js file for future references, but I don't find how you do this in the docs. I have tried // , /**/ , {{-- --}} , and {# #} , but none of them seem to work. I am using Laravel's blade. So this is the sample_file.vue : <template> <div class="media"> <like-button :post="post" v-if="post.likedByCurrentUser === false && "></like-button> {{--I want to comment this but I get an error from the gulp watch: post.canBeLikedByCurrentUser === true--}} <div class="media-left"> <a href="#"> <img class="media-object" v-bind:src="post.user.avatar" v-bind:title=

What is the best practice to show old value when editing a form in Laravel?

陌路散爱 提交于 2019-12-03 01:39:57
I am writing the logic for an edit form and have some complications when displaying data in the inputs. When I initially show the form, I show the records values like: value="{{$dog->title}}" Then when the form does not pass the validation I need to show the old input, so that user does not loose what he has already input. So I need to have a way to display old data like: value="{{old('title')}}" Because I need to input old data in case it exists, I ended up with this code: value="{{$dog->title or old('title')}}" And in controller I check if Request has old input, I assign the $dog var a null

laravel 5.2 How to get route parameter in blade?

非 Y 不嫁゛ 提交于 2019-12-03 01:16:15
this is my url http://project.dev/blogs/image-with-article so, here I need the parameter image-with-article in my blade to display which is a parameter named slug here is in my routes file I need the slug paramter in blade. Route::get('/blogs/{slug}', ['as'=>'blog.by.slug', 'uses'=> 'CmsController@show']); I'm not sure what you mean. If you're trying to construct the route in a Blade template, use <a href="{{ route('blog.by.slug', ['slug' => 'someslug']) }}">...</a> If you're trying to access the given parameter, I would suggest passing it from the controller: // CmsController public function

passing data to a view laravel

我怕爱的太早我们不能终老 提交于 2019-12-02 19:59:10
问题 Just getting to mvc frameworks and im trying to pass data to my view using blade template engine. here's my routes file Route::get('/', 'PagesController@index'); my PagesController <?php namespace App\Http\Controllers; use App\User; use App\Http\Controllers\Controller; class PagesController extends Controller { public function index() { return view('index'); $url = 'example.com'; } public function about() { return 'hello'; } } my index.blade.php file <h1>{{ $url }}</h1> I get the Undefined

Remove @include depending on the route

戏子无情 提交于 2019-12-02 13:44:45
问题 I have a menu partial, that includes a input search bar. But i don't want the search bar to be visibel on all pages, only for two specific uri´s. Is there a way to remove that include in blade? Currently it looks like this: <a href="{{ route('all') }}">all</a> <a href="{{ route('nes') }}">nes</a> <a href="{{ route('snes') }}">snes</a> @include('partials._search') I was thinking something like <a href="{{ route('all') }}">all</a> <a href="{{ route('nes') }}">nes</a> <a href="{{ route('snes') }

Form post request return error 419 unknown status laravel

不想你离开。 提交于 2019-12-02 06:13:53
I want to create new user with id_ward, but when I post submit form it returns error 419(unknown status) please help me <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="exampleModalCenterTitle">Thêm user</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body"> <form action="./admin/users/add_user" method="post" id="form-add-user"> <input type="hidden" name="_token" value="{{csrf_token() }}" /> <div class="form-group row"> <div class="col-md-6"> <label for="add

Laravel Blade : What does it mean the double column in parameter in @extends('adminlte::page')

断了今生、忘了曾经 提交于 2019-12-02 06:00:46
I want to use this Admin Panel : https://github.com/jeroennoten/Laravel-AdminLTE But i don't understand this syntax : @extends('adminlte::page') . The page is a view but what does it mean to add adminlte and the double column in this example ? I have never seen this syntax, and i didn't find about it in the Laravel blade docs, can anyone enlighten me please ? This is used to identify the package from which the view should be loaded from. For example you have a package named neokyuubi/courier inside your vendor folder, and you want to load views from there into the application. Then you would

Laravel undefined variable exception with vue.js

旧城冷巷雨未停 提交于 2019-12-01 22:21:47
I want to test a simple vue.js in laravel blade system, Here is my code in test.blade.php view file: <div id="app"> <p>{{message}}</p> </div> <script src="{{url('/assets/js/vue/vue.min.js')}}"></script> <script> new Vue({ el:'#app', data:{ message:"hello world" } }); </script> The problem is while rendering view file laravel wants to access the message as a variable or constant and because there is no any message variable passed to view I get Use of undefined constant exception. So what's the solution? add @{{message}} that will tell blade to ignore this. It's not a good approach to combine

Laravel blade use $(document).ready function

对着背影说爱祢 提交于 2019-12-01 09:25:47
I'm trying to use laravel blade templates including some javascript code into child view. I have my mail app.blade.php file, where is placed string of jquery initialization: <script src="/js/jquery.min.js"></script> In my subview file settings.blade.php I want to use some jquery functions: @extends('layouts.app') @section ('content') Settings main page @endsection <script type="text/javascript"> $(document).ready(function() { alert("Settings page was loaded"); }); </script> But in browser console I get an error message Uncaught ReferenceError: $ is not defined which seems like jquery was

Laravel blade use $(document).ready function

落爺英雄遲暮 提交于 2019-12-01 06:39:02
问题 I'm trying to use laravel blade templates including some javascript code into child view. I have my mail app.blade.php file, where is placed string of jquery initialization: <script src="/js/jquery.min.js"></script> In my subview file settings.blade.php I want to use some jquery functions: @extends('layouts.app') @section ('content') Settings main page @endsection <script type="text/javascript"> $(document).ready(function() { alert("Settings page was loaded"); }); </script> But in browser