laravel - The Mix manifest does not exist - laravel

The Mix manifest does not exist. (View: /var/www/vhosts/test.com.tr/laravel_emlak_app/resources/views/layouts/guest.blade.php)
In the local, there is no problem its working. But when i upload a server there is a problem. The website is working, but when i enter the including guest.blade.php there is a problem.
My guest.blade.php is in here
<!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>
<!-- Fonts -->
<link href="https://fonts.googleapis.com/css?family=Nunito:400,600,700" rel="stylesheet">
<!-- Styles -->
<link rel="stylesheet" href="{{ asset('css/app.css') }}">
<!-- Scripts -->
<script src="{{ mix('js/app.js') }}" defer></script>
</head>
<body class="bg-light font-sans antialiased">
{{ $slot }}
</body>
</html>
What is the problem. If you help me i will be glad, thanks.

I solved
<script src="{{ mix('js/app.js') }}" defer></script>
Update like below:
<script src="{{ asset('js/app.js') }}" defer></script>

Related

how to keep modal open if there are errors

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/jquery-3.5.1.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">

js file not loading giving ERR_ABORTED 404

I have a Laravel/Vue3 project. For some reason I cannot get the right link to public/js/app.js.
My 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">
<title>Laravel</title>
</head>
<body>
<div id="app">
<map-app/>
</div>
<script src="{{asset('js/app.js')}}"></script>
</body>
</html>
In my .env file:
APP_URL=https://www.evenuitrusten.nl
ASSET_URL=${APP_URL}/bankjesserver/public
I then get the error:
GET https://www.evenuitrusten.nl/bankjesserver/public/js/app.js net::ERR_ABORTED 404
Where index.html is:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
</head>
<body>
<div id="app">
<map-app/>
</div>
<script src="https://www.evenuitrusten.nl/bankjesserver/public/js/app.js"></script>
</body>
</html>
On my server, the url to app.js is
/home/blabla/domains/evenuitrusten.nl/bankjesserver/public/js
The URL in the script tag looks correct. Why am I getting a 404?
I tried all kinds of variations of Asset_URL, but non of them worked.
I tried to simplify the problem bij putting a test.js file in the same folder as my maps.blade.php. This file looks like:
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
</head>
<body>
<div id="app">
<map-app/>
</div>
<script type='text/javascript' src='./test.js'></script>
<script type='text/javascript' src='{{ asset('js/app.js') }}'></script>
</body>
</html>
But also this line leads to a 4040 and teh test.js is not downloaded.

Laravel & VueJS: can't read csrf token from meta tag

I am using VueJS and Laravel, and in console it shows CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token, but I added it in head in meta tag
<!doctype html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>Vicoteka</title>
<link rel="icon" href="{{ url('images/logo.png') }}">
<link href="https://fonts.googleapis.com/css?family=Arimo|Lobster" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="{{ asset('css/app.css') }}">
<script defer src="https://use.fontawesome.com/releases/v5.0.7/js/all.js"></script>
</head>
<body class="bg-grey-lighter leading-normal">
<div id="app">
#yield('content')
#include('components/footer')
</div>
<script src="{{ asset('js/app.js') }}"></script>
</body>
</html>
Am I missing something? I didn't change anything in app.js, and it worked when there was no #yield and #include, but it doesn't work now even when i comment it out

Undefined variable: header (View: C:\blog\resources\views\pages\welcome.blade.php)

I am getting the below error when running application,
Undefined variable: header (View: C:\blog\resources\views\pages\welcome.blade.php)
My getIndex() function in Controller:
public function getIndex(){
\View::make('pages/welcome')->nest('header', 'layout.header');
return view('pages/welcome');
}
My welcome.blade.php
{{ $header }}
<body>
....
</body>
My _partial/header.blade.php,
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="../../favicon.ico">
<title>Blog Template for Bootstrap</title>
<!-- Bootstrap core CSS -->
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="{{ asset('css/style.css') }}" rel="stylesheet">
</head>
After following the answer, the html looks like,
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="../../favicon.ico">
<title>Blog Template for Bootstrap</title>
<!-- Bootstrap core CSS -->
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="http://127.0.0.1:8000/css/style.css" rel="stylesheet">
</head>
You're creating a view with a nested subview, then creating & returning a totally new view without the nested subview instead:
public function getIndex(){
\View::make('pages/welcome')->nest('header', 'layout.header');
return view('pages/welcome');
}
Should be
public function getIndex(){
return \View::make('pages/welcome')->nest('header', 'layout.header');
}
Note that view() is an alias of \View::make().
You can prevent the HTML from being escaped by using {!! $header !!} instead.
With Laravel 5+ development, you should be using Components and Slots to inject templates into your views instead.

How can I correctly import an header and a footer page into a FreeMarker page?

I am working on a Spring MVC application that use FreeMarker for my views.
I am absolutly new in FreeMarker and I have the following problem: in my projct I have 3 files that have to be assemblet togheter into a single page.
So I have:
1) header.ftl representing the header of all my pages, somthing like:
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js is-ie8"><![endif]-->
<!--[if gt IE 8]><!--><html class="no-js"><!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Registrazione - MY WEBSITE</title>
<meta name="robots" content="noindex,nofollow">
<link rel="stylesheet" href="resources/css/webfont.css">
<link rel="stylesheet" href="resources/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="resources/bootstrap/css/bootstrap-theme.min.css">
<link rel="stylesheet" href="resources/plugins/bs-select/bootstrap-select.min.css">
<link rel="stylesheet" href="resources/plugins/bs-dialog/bootstrap-dialog.min.css">
<link rel="stylesheet" href="resources/css/style.css" />
</head>
<body id="main">
<!-- versione per popup. non prendere in considerazione -->
<!--
<div class="container page-header">
<h1>MY WEBSITE</h1>
</div>
2) footer.ftl representing the footer of all my pages:
<script src="assets/bootstrap/js/bootstrap.min.js"></script>
<script src="assets/plugins/bs-select/bootstrap-select.min.js"></script>
<script src="assets/plugins/bs-select/i18n/defaults-it_IT.min.js"></script>
<script src="assets/plugins/bs-dialog/bootstrap-dialog.min.js"></script>
<script src="assets/plugins/jq-form-validation/jquery.validation.js"></script>
<script src="assets/js/functions.lib.js"></script>
<script src="assets/js/form-validation.js"></script>
</body>
</html>
3) Then I have my specific page (named myPage.ftl that represent only the content, something like this:
<h1>This is the content</h1>
<p>Some inforamation</p>
The header.ftl and the footer.ftl are into this directory **\WEB-INF\freemarker\layout** of my project.
So my problem is: how can I import the header.ftl content above the content of the myPage.ftl and the footer.ftl under the content of myPage.ftl page?
I did this using user-defined macros for page layouts, e.g. let's call your layout standardPage.ftl:
<#macro standardPage title="">
<!DOCTYPE html>
<html lang="en">
<head>
<title>${title}</title>
</head>
<body>
<#include "/include/header.ftl">
<#nested/>
<#include "/include/footer.ftl">
</body>
</html>
</#macro>
Then you can call this macro in each of your pages, e.g. homePage.ftl:
<#include "/pages/standardPage.ftl" />
<#standardPage title="Home">
<h1>Home Page</h1>
<p>This bit replaces the nested tag in the layout</p>
</#standardPage>

Resources