Have you changed your storage permissions?
chmod o+w -R app/storage/
I checked my raw access logs, and I have this.
My IP - - [13/Oct/2014:14:02:34 +0200] "GET /admin/menus HTTP/1.1" 404 - "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.101 Safari/537.36"
I ended up going through my pages and I saw this error
Parse error: syntax error, unexpected '[' in /home/webkrunc/main-laravel/vendor/laravel/framework/src/Illuminate/Support/helpers.php on line 411
I'm not sure how to go about fixing that type of error
You need to take a look at the view, controller and maybe the route that is responsible for generating this page. Basically, that error is suggesting that syntax error - a typo, missing code etc.
It actually is suggesting that it is an error in helpers - unless this has been edited, it won't be that.
If you can't track it down, post your code and we can take a look.
Also, check in: app/config/app.php - you'll see a 'debug' section. Make sure this is set to true while you are developing and this rill pump out errors that can be very useful.
Hope that helps.
Here is my code. It's quite a bit.
My hello.php. This is my frontend page and it is also where the error is displaying.
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>My Site</title>
<style>
@import url(//fonts.googleapis.com/css?family=Lato:700);
body {
margin:0;
font-family:'Lato', sans-serif;
text-align:center;
color: #999;
}
.welcome {
width: 300px;
height: 200px;
position: absolute;
left: 50%;
top: 50%;
margin-left: -150px;
margin-top: -100px;
}
a, a:visited {
text-decoration:none;
}
h1 {
font-size: 32px;
margin: 16px 0 0 0;
}
</style>
</head>
<body>
<div class="welcome">
<h1>Under Construction</h1>
</div>
</body>
</html>
This is my admin.blade.php it is my master template for the admin section
<?php
ini_set('display_errors', 1);
error_reporting(~0);
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Admin</title>
{{ HTML::style('css/bootstrap-theme.css') }}
{{ HTML::style('css/bootstrap-theme.css.map') }}
{{ HTML::style('css/bootstrap-theme.min.css') }}
{{ HTML::style('css/bootstrap.css') }}
{{ HTML::style('css/bootstrap.css.map') }}
{{ HTML::style('css/bootstrap.min.css') }}
{{ HTML::style('css/custom.css') }}
{{ HTML::style('css/font-awesome.css') }}
{{ HTML::style('css/morris-0.4.3.min.css') }}
{{ HTML::style('css/styles.css') }}
{{ HTML::script('js/jquery-1.10.2.js') }}
{{ HTML::script('js/main.js') }}
<!-- GOOGLE FONTS-->
<link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css' />
</head>
<body>
<div id="wrapper">
<nav class="navbar navbar-default navbar-cls-top " role="navigation" style="margin-bottom: 0">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".sidebar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.html">Binary admin</a>
</div>
<div style="color: white;
padding: 15px 50px 5px 50px;
float: right;
font-size: 16px;"> Last access : 30 May 2014 <a href="#" class="btn btn-danger square-btn-adjust">Logout</a> </div>
</nav>
<!-- /. NAV TOP -->
<nav class="navbar-default navbar-side" role="navigation">
<div class="sidebar-collapse">
<ul class="nav" id="main-menu">
<li class="text-center">
<img src="../img/find_user.png" class="user-image img-responsive"/>
</li>
@if(Request::segment(2) == 'dashboard')
<li>
{{ HTML::decode(HTML::link('admin/dashboard', '<i class="fa fa-dashboard fa-3x"></i>Dashboard 1', array("class" => "dashboard active-menu"))) }}
</li>
@else
<li>
{{ HTML::decode(HTML::link('admin/dashboard', '<i class="fa fa-dashboard fa-3x"></i>Dashboard 1', array("class" => "dashboard"))) }}
</li>
@endif
@if(Request::segment(2) == 'menus')
<li>
{{ HTML::decode(HTML::link('admin/menus', '<i class="fa fa-th-list fa-3x"></i>Menus 1', array("class" => "menus active-menu"))) }}
</li>
@else
<li>
{{ HTML::decode(HTML::link('admin/menus', '<i class="fa fa-th-list fa-3x"></i>Menus 1', array("class" => "menus "))) }}
</li>
@endif
</ul>
</div>
</nav>
<!-- /. NAV SIDE -->
<div id="page-wrapper" >
<div id="page-inner">
<div class="row">
<div class="col-md-12">
<h2>Blank Page</h2>
<h5>Welcome John Doe , Love to see you back. </h5>
</div>
</div>
<!-- /. ROW -->
<hr />
@yield('content')
</div>
<!-- /. PAGE INNER -->
</div>
<!-- /. PAGE WRAPPER -->
</div>
<!-- /. WRAPPER -->
<!-- SCRIPTS -AT THE BOTOM TO REDUCE THE LOAD TIME-->
<!-- JQUERY SCRIPTS -->
{{ HTML::script('js/bootstrap.js') }}
{{ HTML::script('js/bootstrap.min.js') }}
</body>
</html>
This is my index.blade.php it is where the menu items are displayed. It is part of the admin section
@extends('admin.layouts.admin')
@section('content')
<div class="row">
<div class="col-md-12">
{{ HTML::linkAction('admin\MenusController@create', 'Create a menu', array(), array("class" => "btn btn-info create-menu", "role" => "button")) }}
<div class="panel panel-default">
<div class="panel-heading">
MENUS
</div>
<div class="panel-body">
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th>Title</th>
<th>Edit</th>
<th>Delete</th>
</tr>
</thead>
<tbody>
@foreach($menus as $menu)
<tr>
<td>
{{ HTML::linkAction('admin\MenusController@edit', $menu->title, array($menu->id)) }}
</td>
<td>
{{ HTML::decode(HTML::linkAction('admin\MenusController@edit', '<i class="fa fa-edit"></i> Edit', array($menu->id), array('class' => 'btn btn-primary', 'role' => 'button'))) }}
</td>
<td>
{{ Form::open(array('method' => 'Delete', 'route' => array('admin.menus.destroy', $menu->id), 'class' => 'delete-form')) }}
<button class="btn btn-danger"><i class="fa fa-pencil"></i> Delete</button>
{{ Form::close() }}
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
@stop
This is my Menu model
<?php
use Illuminate\Auth\UserTrait;
use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableTrait;
use Illuminate\Auth\Reminders\RemindableInterface;
class Menus extends \Eloquent implements UserInterface, RemindableInterface{
use UserTrait, RemindableTrait;
protected $fillable = array('title', 'submenu_id');
protected $guarded = array('id');
protected $table = 'menus';
public static $rules = array(
'title' => 'required'
);
}
This is my MenusController. It is in an admin folder in the app/controllers
<?php
namespace Admin;
use BaseController;
class MenusController extends \BaseController {
/**
* Display a listing of the resource.
* GET /menus
*
* @return Response
*/
public function index()
{
$menus = \Menus::all();
return \View::make('admin.menus.index', compact('menus'));
}
/**
* Show the form for creating a new resource.
* GET /menus/create
*
* @return Response
*/
public function create()
{
$submenu_options = \Menus::lists('title', 'id');
return \View::make('admin.menus.create')->with('submenu_options', $submenu_options);
}
/**
* Store a newly created resource in storage.
* POST /menus
*
* @return Response
*/
public function store()
{
$input = \Input::all();
$validation = \Validator::make($input, \Menus::$rules);
if($validation->fails()){
return \Redirect::route('admin.menus.index')
->withInput()
->withErrors($validation)
->with('message', 'There were validation errors.');
}
if($validation->passes()){
\Menus::create($input);
$menus = \Menus::all();
return \View::make('admin.menus.index', compact('menus'));
}
}
/**
* Display the specified resource.
* GET /menus/{id}
*
* @param int $id
* @return Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
* GET /menus/{id}/edit
*
* @param int $id
* @return Response
*/
public function edit($id)
{
$menus = \Menus::find($id);
$submenu_options = \Menus::lists('title', 'id');
if(is_null($menus)){
return \Redirect::route('admin.menus.index');
}
return \View::make('admin.menus.edit', compact('menus'))->with('submenu_options', $submenu_options);
}
/**
* Update the specified resource in storage.
* PUT /menus/{id}
*
* @param int $id
* @return Response
*/
public function update($id)
{
$input = \Input::all();
$validation = \Validator::make($input, \Menus::$rules);
if($validation->fails()){
return \Redirect::route('admin.menus.edit')
->withInput()
->withErrors($validation)
->with('message', 'There were validation errors.');
}
if($validation->passes()){
$menus = \Menus::find($id);
$menus->update($input);
return \Redirect::route('admin.menus.index', $id);
}
}
/**
* Remove the specified resource from storage.
* DELETE /menus/{id}
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
\Menus::find($id)->delete();
$menus = \Menus::all();
return \View::make('admin.menus.index', compact('menus'));
}
}
If you need anything else please let me know
So what URL are you hitting when you get the error? Any? If you add php artisan tail in your console and then go through the routes you have specified, you should see it pop up when you hit the offending route.
I've only glanced at all the code, but can't see anything major. Have you turned debug to 'true'? This will help.
There are a few things that could be causing this. Its difficult to figure out what it is from this side.
A good approach is to start form the basics. comment out bits in your code until the issue is resolved and then you should be able to see what is causing the issue.
Also, can you post your routes.php?
Here are my routes
Route::get('/', function()
{
return View::make('hello');
});
Route::get('admin/dashboard', 'admin\AdminController@index');
Route::resource('admin/menus', 'admin\MenusController');
What PHP version are you using? An unexpected [ could be the use of the new array syntax which requires php 5.4 or higher, which you should be using anyway as 5.3 is EOL and unsupported.
I had php 5.3 so I changed it to php 5.5. The error disappeared but I still can't view my other pages
Can you change the hello.php to blade template?
The home page is still showing when I put in the blade elements and change it to a blade template
I found the best solution for this problem. i hope this will help all of you.
How to Resolve Laravel Blank Page on Real Server
Thank you.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community