I am very new to Laravel and I have been given a very old project and asked to use vagrant/homestead. The project uses php7.2 and doesn't have php artisan. It also doesn't have public folder. The problem is that the I am getting a blank view with status code 200. My homestead.yaml is:
folders:
- map: C:\Users\Desktop\school_erp_lms
to: /home/vagrant/school_lms
sites:
- map: school-lms.test
to: /home/vagrant/school_lms
php: "7.2"
databases:
- u789138695_schoolerp
route.php is:
Route::get('/login','LoginController@index');
LoginController is:
<?php
namespace App\Http\Controllers;
use View;
class LoginController extends Controller
{
public $data = array();
public function __construct()
{
$this->panelInit = new \DashboardInit();
$this->data['panelInit'] = $this->panelInit;
}
public function index()
{
return View::make('login', $this->data);
}
}
.env is:
DB_NAME=u789138695
DB_USERNAME=user
DB_PASSWORD=""
DEBUG=true
login.blade.php is:
<!DOCTYPE html>
<html lang="en" <?php if($panelInit->isRTL == 1){ ?>dir="rtl"<?php } ?> style="background:none;">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- Tell the browser to be responsive to screen width -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<!-- Favicon icon -->
<?php if($panelInit->settingsArray['favicon'] == "e"){ ?>
<link rel="icon" type="image/png" sizes="16x16" href="{{URL::asset('assets/images/favicon.png')}}">
<?php } ?>
<title><?php echo $panelInit->settingsArray['siteTitle'] . " | " . $panelInit->language['signIn']; ?></title>
<!-- Bootstrap Core CSS -->
<link href="{{URL::asset('assets/plugins/bootstrap/css/bootstrap.min.css')}}" rel="stylesheet">
<!-- Custom CSS -->
<?php if($panelInit->isRTL == 1){ ?>
<link href="{{URL::asset('assets/css/style-rtl.css')}}" rel="stylesheet">
<link href="{{URL::asset('assets/plugins/bootstrap-rtl-master/dist/css/custom-bootstrap-rtl.css')}}" rel="stylesheet" type="text/css" />
<?php }else{ ?>
<link href="{{URL::asset('assets/css/style.css')}}" rel="stylesheet">
<?php } ?>
<link href="{{URL::asset('assets/css/custom.css')}}" id="theme" rel="stylesheet">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<?php
$bgStyling = "";
if($panelInit->settingsArray['authPageImage'] == "1"){
$bgStyling .= "background-image:url('".URL::asset('assets/images/login-register.jpg')."'); ";
}
if($panelInit->settingsArray['authPageColor'] != ""){
$bgStyling .= "background-color:".$panelInit->settingsArray['authPageColor'].";";
}
?>
<body class="loginMark" style="<?php echo $bgStyling; ?>;background-attachment:fixed; background-repeat: repeat-y;background-size: cover;" >
<!-- ============================================================== -->
<!-- Preloader - style you can find in spinners.css -->
<!-- ============================================================== -->
<div class="preloader">
<svg class="circular" viewBox="25 25 50 50">
<circle class="path" cx="50" cy="50" r="20" fill="none" stroke-width="2" stroke-miterlimit="10" /> </svg>
</div>
<!-- ============================================================== -->
<!-- Main wrapper - style you can find in pages.scss -->
<!-- ============================================================== -->
<section id="wrapper" <?php if($panelInit->settingsArray['loginPageStyle'] == "r"){ echo 'class="login-register login-sidebar" style="'.$bgStyling.'"'; } ?>>
<div <?php if($panelInit->settingsArray['loginPageStyle'] == "r"){ echo 'class="login-box card"'; }else{ echo 'class="login-register" '; } ?> >
<?php if($panelInit->settingsArray['loginPageStyle'] == "c"){ ?><div class="login-box card"><?php } ?>
<div class="card-block">
<form class="form-horizontal form-material" id="loginform" action="{{URL::to('/login')}}" method="post">
<a href="javascript:void(0)" class="text-center db logo-text-login">
<?php
if($panelInit->settingsArray['siteLogo'] == "siteName"){
echo $panelInit->settingsArray['siteTitle'];
}elseif($panelInit->settingsArray['siteLogo'] == "text"){
echo $panelInit->settingsArray['siteLogoAdditional'];
}elseif($panelInit->settingsArray['siteLogo'] == "image"){
?><img src="<?php echo URL::asset('assets/images/logo-light.png'); ?>" /><?php
}
?>
</a>
<h3 class="box-title m-b-20"><?php echo $panelInit->language['signIn']; ?></h3>
@if($errors->any())
<span style='color:red;'>{{$errors->first()}}</span><br/><br/>
@endif
<div class="form-group ">
<div class="col-xs-12">
<input class="form-control" type="text" name="email" required="" placeholder="<?php echo $panelInit->language['userNameOrEmail']; ?>">
</div>
</div>
<div class="form-group">
<div class="col-xs-12">
<input class="form-control" type="password" name="password" required="" placeholder="<?php echo $panelInit->language['password']; ?>">
</div>
</div>
<div class="form-group">
<div class="col-md-12">
<div class="checkbox checkbox-primary pull-left p-t-0">
<input id="checkbox-signup" name="remember_me" type="checkbox">
<label for="checkbox-signup"> <?php echo $panelInit->language['rememberMe']; ?> </label>
</div> <a href="{{URL::to('/forgetpwd')}}" class="text-dark pull-right"><i class="fa fa-lock m-r-5"></i> <?php echo $panelInit->language['restorePwd']; ?></a> </div>
</div>
<div class="form-group text-center m-t-20">
<div class="col-xs-12">
<input type="hidden" name="_token" value="<?php echo csrf_token(); ?>">
<button class="btn btn-info btn-lg btn-block text-uppercase waves-effect waves-light" type="submit"><?php echo $panelInit->language['signIn']; ?></button>
</div>
</div>
<?php if(isset($panelInit->settingsArray['allowPublicReg']) AND $panelInit->settingsArray['allowPublicReg'] == "1"){ ?>
<div class="form-group m-b-0">
<div class="col-sm-12 text-center">
<p><a href="{{URL::to('/register')}}" class="text-info m-l-5"><b><?php echo $panelInit->language['registerNewAccount']; ?></b></a></p>
</div>
</div>
<?php } ?>
<div class="form-group m-b-0">
<div class="col-sm-12 text-center">
<p><a href="{{URL::to('/terms')}}" class="text-info m-l-5"><b><?php echo $panelInit->language['schoolTerms']; ?></b></a></p>
</div>
</div>
</form>
</div>
<?php if($panelInit->settingsArray['loginPageStyle'] == "c"){ ?></div><?php }?>
</div>
</section>
<script src="{{URL::asset('assets/plugins/jquery/jQuery-2.1.4.min.js')}}"></script>
<!-- Bootstrap tether Core JavaScript -->
<script src="{{URL::asset('assets/plugins/bootstrap/js/tether.min.js')}}"></script>
<script src="{{URL::asset('assets/plugins/bootstrap/js/bootstrap.min.js')}}"></script>
<!-- slimscrollbar scrollbar JavaScript -->
<script src="{{URL::asset('assets/js/jquery.slimscroll.js')}}"></script>
<!--Wave Effects -->
<script src="{{URL::asset('assets/js/waves.js')}}"></script>
<!--stickey kit -->
<script src="{{URL::asset('assets/plugins/sticky-kit-master/dist/sticky-kit.min.js')}}"></script>
<!--Custom JavaScript -->
<script src="{{URL::asset('assets/js/custom.min.js')}}"></script>
<?php if( isset($panelInit->settingsArray['gTrackId']) AND $panelInit->settingsArray['gTrackId'] != "" ): ?>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', '<?php echo $panelInit->settingsArray['gTrackId']; ?>', 'auto');
ga('send', 'pageview');
</script>
<?php endif; ?>
</body>
</html>
The "login.blade.php" file exists under resources/views. The response I am getting is a blank screen with status code 200. I have tried other blades also inplace of login and still got the same response. But when I provided an invalid blade name, I got an error saying blade doesn't exist. Any help is appreciated.
Hmmm... To be honest - I'm not sure. I can't really find any bad part of what you're posted.
Maybe it's a caching error.
You say that you don't havephp artisan
working. Hmm... How do you clear the cache then? The command:php artisan cache:clear
None the less... The first command that comes to mind is to try and clear the cache and generates composer-files, with this command:
php artisan cache:clear && composer dump-autoload
But if you can't dophp artisan
, then maybe just do:composer dump-autoload
If it was me, then I would start at the routes, changing this:
Route::get('/login','LoginController@index');
to this:
dd('hey');
Route::get('/login','LoginController@index');
And then reloading the page. You should then see it say 'Hey' on the screen.
... If that works, then change it to this:
Route::get('/login','LoginController@index');
dd('hey');
Then it _SHOULDN'T say 'Hey' on the screen.
... Then I would work my way through the controller as well.
And afterwards through the view.
To find the place where it deviates what you expect should happen and what really happens.
Fun fact:
I have tried once, where I did this - and moved thedd
-statement aaaaaall the way through my code. And in the end, when I simply removed thedd
-statement then the unexpected behaviour was gone. It must have been some caching or something.
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Find the answer in similar questions on our website.
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.
PHP (from the English Hypertext Preprocessor - hypertext preprocessor) is a scripting programming language for developing web applications. Supported by most hosting providers, it is one of the most popular tools for creating dynamic websites.
The PHP scripting language has gained wide popularity due to its processing speed, simplicity, cross-platform, functionality and distribution of source codes under its own license.
https://www.php.net/
Laravel is a free open source PHP framework that came out in 2011. Since then, it has been able to become the framework of choice for web developers. One of the main reasons for this is that Laravel makes it easier, faster, and safer to develop complex web applications than any other framework.
https://laravel.com/
Slim is, as its name suggests, a micro-framework that is compact and fast. The reason for its such characteristics lies in the fact that it is completely independent of third-party code. It was created in 2010, at the moment its most recent version is 4.5.0.
https://www.slimframework.com/
JavaScript is a multi-paradigm language that supports event-driven, functional, and mandatory (including object-oriented and prototype-based) programming types. Originally JavaScript was only used on the client side. JavaScript is now still used as a server-side programming language. To summarize, we can say that JavaScript is the language of the Internet.
https://www.javascript.com/
JQuery is arguably the most popular JavaScript library with so many features for modern development. JQuery is a fast and concise JavaScript library created by John Resig in 2006. It is a cross-platform JavaScript library designed to simplify client-side HTML scripting. Over 19 million websites are currently using jQuery! Companies like WordPress, Facebook, Google, IBM and many more rely on jQuery to provide a kind of web browsing experience.
https://jquery.com/
CSS (Cascading Style Sheets) is a formal language for describing the appearance of a document written using a markup language.
It is mainly used as a means of describing, decorating the appearance of web pages written using HTML and XHTML markup languages, but can also be applied to any XML documents, such as SVG or XUL.
https://www.w3.org/TR/CSS/#css
Bootstrap is not exclusively a CSS framework, but its most popular features are CSS-centric. These include a powerful grid, icons, buttons, map components, navigation bars, and more.
https://getbootstrap.com/
HTML (English "hyper text markup language" - hypertext markup language) is a special markup language that is used to create sites on the Internet.
Browsers understand html perfectly and can interpret it in an understandable way. In general, any page on the site is html-code, which the browser translates into a user-friendly form. By the way, the code of any page is available to everyone.
https://www.w3.org/html/
Welcome to the Q&A site for web developers. Here you can ask a question about the problem you are facing and get answers from other experts. We have created a user-friendly interface so that you can quickly and free of charge ask a question about a web programming problem. We also invite other experts to join our community and help other members who ask questions. In addition, you can use our search for questions with a solution.
Ask about the real problem you are facing. Describe in detail what you are doing and what you want to achieve.
Our goal is to create a strong community in which everyone will support each other. If you find a question and know the answer to it, help others with your knowledge.