ERR_FILE_NOT_FOUND - laravel-5

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.

Related

Title and all <head> content in <body>

This is the structure of the views folder:
/layout
header.blade.php
footer.blade.php
template.blade.php
index.blade.php
header content:
<!DOCTYPE html>
<html>
<head>
<link rel="shortcut icon" href="{{ asset('img/favicon.png') }}">
<link rel="apple-touch-icon" href="{{ asset('img/favicon.png') }}">
<title>#yield('title')</title>
</head>
<body>
footer:
<script src="{{ asset('js/jquery-3.6.0.min.js') }}"></script>
<script src="{{ asset('js/custom.js') }}"></script>
#stack('scripts')
</body>
</html>
template:
#include('layout.header')
#yield('content')
#include('layout.footer')
index:
#extends('layout.template')
#section('title', 'Title')
#section('content')
<div>Content</div>
#endsection
When I inspect the html that's how the structure looks like:
<html>
<head></head>
<body>
<link rel="icon" href="http://localhost/project/public/img/favicon.png">
<title>testing</title>
<div>Test</div>
<script src="http://localhost/project/public/js/jquery-3.6.0.min.js"></script>
<script src="http://localhost/project/public/js/custom.js"></script>
</body>
</html>
This causes the favicon not to be displayed.
How to fix this issue?
You are making this much more complicated then it needs to be. You can use the #extend method to use a template file. I would make it like this:
/layouts/app.blade.php
index.blade.php
<!-- app.blade.php -->
<!DOCTYPE html>
<html>
<head>
<link rel="shortcut icon" href="{{ asset('img/favicon.png') }}">
<link rel="apple-touch-icon" href="{{ asset('img/favicon.png') }}">
<title>#yield('title', 'Title')</title>
</head>
<body>
#yield('content')
<script src="{{ asset('js/jquery-3.6.0.min.js') }}"></script>
<script src="{{ asset('js/custom.js') }}"></script>
</body>
</html>
<!-- index.blade.php -->
#extends('layouts.app')
#section('title, 'My Page Title')
#section('content')
<div>
<!-- Go crazy -->
<!-- Everything in here will take place of the #yield('content') area -->
<!-- in the app.blade.php file -->
</div>
#endsection

Adding vue component to Laravel's main welcome.blade.php file

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?

Laravel 8: Session::forget() not working in blade file

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.

Laravel vue with two different layout

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>

Unknown errors using csrf_token. Laravel

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('/') }}";

Resources