I need to connect some files, using csrf_token (from laravel), but i have unknown errors such as:
<link rel="stylesheet" href="{{ asset('css/app.css) }}">syntax error, unexpected ''css/app.css)); ?>">' (T_ENCAPSED_AND_WHITESPACE)
<script>
var BASE_URL = '{{ URL::to('/') }}';
</script>syntax error, unexpected '?'
<script src="{{ asset('js/app.js') }}"></script>syntax error, unexpected 'js' (T_STRING), expecting ')'
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>Auth</title>
<link rel="stylesheet" href="{{ asset('css/app.css) }}">
</head>
<body>
<div id="app"></div>
<script>
var BASE_URL = '{{ URL::to('/') }}';
</script>
<script src="{{ asset('js/app.js') }}"></script>
</body>
</html>
You have missed a quote
instead of
<link rel="stylesheet" href="{{ asset('css/app.css) }}">
use
<link rel="stylesheet" href="{{ asset('css/app.css') }}">
For second, instead of
var BASE_URL = '{{ URL::to('/') }}';
use
var BASE_URL = "{{ URL::to('/') }}";
Related
I'm trying to add a header component to my main 'welcome.blade.php' file, but it's content is not rendering. What am I doing wrong here?
I have made my header component in my components folder like this:
<template>
<div class="header">This is the header.</div>
</template>
<script>
export default {
name: "Header",
};
</script>
Then I imported my header to my main app.js file and registered my component like this:
import Header from './components/header';
Vue.component('header', Header);
Eventually I added my header tags to Laravel's main 'welcome.blade.php' file within the #app container:
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<!--<link rel="shortcut icon" href="{{ asset('images/evoqia-icon-gray.png') }}" />-->
<link rel="shortcut icon" href="//creatio.com/themes/custom/creatio/favicon.ico" />
<title>{{ config('app.name') }}</title>
</head>
<body class="antialiased">
<div id="app" v-cloak>
<header></header>
<div class="content-wrapper" :class="{'nopadding': !$store.state.authStore.user}">
<div class="container app-container">
<router-view></router-view>
</div>
</div>
</div>
<script>
var Laravel = {
'csrfToken': '{{ csrf_token() }}'
};
</script>
<link href="{{ asset('css/app.css') }}" rel="stylesheet">
<script src="{{ asset('js/app.js') }}"></script>
</body>
</html>
So what am I doing wrong here?
I would like to let the modal keep open if there are errors,but the modal will not auto open when there are errors
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link href="{{ asset('css/app.css') }}" rel="stylesheet">
<script src="//unpkg.com/alpinejs" defer></script>
<script src="{{ url('/js/jquery.min.js') }}"></script>
<script src="js/bootstrap.min.js"></script>
#if($errors->any())
<script type="text/javascript">
$(document).ready(function(){
$('#modal-title').modal('show');
});
</script>
#endif
modal
<form action="/employee" class="action" method="POST">
#csrf
<div class="fixed z-10 inset-0 overflow-y-scroll" aria-labelledby="modal-title" id="modal-title" role="dialog" aria-modal="true"
x-show="open">
try this
<script type="text/javascript">
#if (count($errors) > 0)
$('#modal-title').modal('show');
#endif
</script>
I have a blade file thanks.blade.php where I put two sessions grand_total and order_id. When I refresh the page session still exists.
I want when I refresh the page the session should be destroyed. I have written the session forget code at the end. Is it correct? I think it's not correct then how to write it.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<title>Thanks</title>
<link href="{{ url('css/front_css/bootstrap.min.css') }}" rel="stylesheet">
<link href="{{ url('css/front_css/font-awesome.min.css') }}" rel="stylesheet">
<link href="{{ url('css/front_css/prettyPhoto.css') }}" rel="stylesheet">
<link href="{{ url('css/front_css/price-range.css') }}" rel="stylesheet">
<link href="{{ url('css/front_css/animate.css') }}" rel="stylesheet">
<link href="{{ url('css/front_css/main.css') }}" rel="stylesheet">
<link href="{{ url('css/front_css/responsive.css') }}" rel="stylesheet">
<!--[if lt IE 9]>
<script src="{{ url('js/front_js/html5shiv.js') }}"></script>
<script src="{{ url('js/front_js/respond.min.js') }}"></script>
<![endif]-->
<!-- favicon -->
<link rel="icon" type="image/png" sizes="192x192" href="{{ asset('images/ico/android-icon-192x192.png')}}">
</head>
<!--/head-->
<body>
<!-- Header Part -->
#include('layouts.front_layout.front_header')
<div class="jumbotron text-center">
<h1 class="display-3">Thank You!</h1>
<p class="lead"><strong>Your Order Is Successfully Place</strong></p>
<p class="lead">Your Order number is {{Session::get('order_id')}} and grand total is PK. {{Session::get('grand_total')}}</p>
<hr>
<p>
<strong>Please check your email</strong> for further instruction. Having trouble? Contact us
</p>
<p class="lead">
<a class="btn btn-primary btn-sm" href="{{url('/')}}" role="button">Continue to homepage</a>
</p>
</div>
<!--/Footer-->
#include('layouts.front_layout.front_footer')
<script src="{{ url('js/front_js/jquery.js') }}"></script>
<script src="{{ url('js/front_js/bootstrap.min.js') }}"></script>
<script src="{{ url('js/front_js/main.js') }}"></script>
</body>
</html>
<php Session::forget('grand_total'); Session::forget('order_id'); ?>
You have to use following code below
#php
Illuminate\Support\Facades\Session::forget('grand_total');
Illuminate\Support\Facades\Session::forget('order_id');
#endphp
It is working fine for me. I have just now used in my project.
I that possible to have different layout in laravel vue components?
If we use blades all we need is to change #extends('layouts.app') to #extends('layouts.custom') and then you have different design, but how it's working in vuejs?
Code
This is my App.vue file which is in charge of rendering template of all pages
<template>
<div>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
//navbar
</nav>
<el-container>
<el-header>Header</el-header>
<el-container>
<el-aside width="200px">
<h5>{{site_name}}</h5>
</el-aside>
<el-main>
<a class="sr-only sr-only-focusable" href="#content">Skip to main content</a>
<div>
<transition name="fade">\
//router which renders all components in this part
<router-view id="content" :key="$route.fullPath"></router-view>
</transition>
</div>
</el-main>
</el-container>
<el-footer>Footer</el-footer>
</el-container>
</div>
</template>
and here is my layout blade file:
<!doctype html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="csrf-token" content="{{ csrf_token() }}" />
<title>{{ config('app.name', 'Laravel') }}</title>
<link href="{{ asset('css/app.css') }}" rel="stylesheet" />
</head>
<body>
<div id="app"></div>
<script src="{{ asset('js/app.js') }}"></script>
<script>
window.default_locale = "{{ config('app.locale') }}";
window.fallback_locale = "{{ config('app.fallback_locale') }}";
</script>
</body>
</html>
Basically that aside part in app.vue i only need to show in admin part not front-end (for users)
Any idea?
Pass it as a prop to your component
Something like:
Blade File:
#php
$isLoggedIn = Auth::check();
#endphp
<my-component :is-logged-in="{{ $isLoggedIn }}" </<my-component>
im new in php.
im about to make landing page. every file are right in the folder. Idk why i get error like this :
enter image description here
this is my code :
<!DOCTYPE html>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="csrf-token" content="{!! csrf_token() !!}">
<title>Ortwo School Management System</title>
<link href="{{ asset('templates/admin/css/bootstrap.min.css') }}" rel="stylesheet">
<link href="{{ asset('templates/admin/font-awesome/css/font-awesome.css') }}" rel="stylesheet">
<link href="{{ asset('templates/admin/css/plugins/iCheck/custom.css') }}" rel="stylesheet">
<link href="{{ asset('templates/admin/css/animate.css') }}" rel="stylesheet">
<link href="{{ asset('templates/admin/css/style.css') }}" rel="stylesheet">
<link href="{{ asset('templates/admin/css/plugins/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css') }}" rel="stylesheet">
<link href="{{ asset('assets/plugins/formvalidation/dist/css/formValidation.css') }}" rel='stylesheet' type='text/css' />
<link href="{{ asset('templates/admin/css/plugins/toastr/toastr.min.css') }}" rel="stylesheet">
<link href="{{ asset('assets/css/sweetalert.css') }}" rel="stylesheet">
#section("css")
#show
<script src="{{ asset('templates/admin/js/jquery-2.1.1.js') }}">
</script>
<script src="{{ asset('templates/admin/js/bootstrap.min.js') }}">
</script>
<script src="{{
asset('templates/admin/js/plugins/metisMenu/jquery.metisMenu.js') }}">
</script>
<script src="{{
asset('templates/admin/js/plugins/slimscroll/jquery.slimscroll.min.js')
}}"></script>
<!-- Custom and plugin javascript -->
<script src="{{ asset('templates/admin/js/inspinia.js') }}"></script>
<script src="{{ asset('templates/admin/js/plugins/pace/pace.min.js')
}}"></script>
<script src="{{ asset('templates/admin/js/plugins/wow/wow.min.js') }}">
</script>
pls somebody help me..
thanks anyway
you haven't executed the code, you have just opened a blade template file in a browser (see url with 'file' prefix). You should open the page via a route url defined in the routes/web.php file in your application.