Laravel-Backpack / CRUD

Build custom admin panels. Fast!
https://backpackforlaravel.com
MIT License
3.17k stars 896 forks source link

Getting a syntax error on create #1686

Closed jim1506 closed 5 years ago

jim1506 commented 6 years ago

I have a table "companydetails" and I went through your instructions by generating the appropriate items, but when I go to the add I get the following message:

syntax error, unexpected 'stylesheet' (T_STRING), expecting ',' or ')' (View: D:\Laravel\AssociatedLocks\resources\views\vendor\backpack\crud\form_content.blade.php) (View: D:\Laravel\AssociatedLocks\resources\views\vendor\backpack\crud\form_content.blade.php)

The problem seems to be the first line of this generated code block:

<?php $__env->startSection('after_styles'); ?>

<link rel="stylesheet" href="<?php echo e(asset('vendor/backpack/crud/css/form.css')); ?>">
<link rel="stylesheet" href="<?php echo e(asset('vendor/backpack/crud/css/'.$action.'.css')); ?>">

The code on the template that generates this code seems to be OK:

@section('after_styles') link rel="stylesheet" href="{{ asset('vendor/backpack/crud/css/crud.css') }}"> link rel="stylesheet" href="{{ asset('vendor/backpack/crud/css/form.css') }}"> link rel="stylesheet" href="{{ asset('vendor/backpack/crud/css/'.$action.'.css') }}">

(I have had to remove the initial < on the link as the markdown hated it.,

I get this on any create or edit.

welcome[bot] commented 6 years ago

Hello there! Thanks for opening your first issue on this repo!

Just a heads-up: Here at Backpack we use Github Issues only for tracking bugs. Talk about new features is also acceptable. This helps a lot in keeping our focus on improving Backpack. If you issue is not a bug/feature, please help us out by closing the issue yourself and posting in the appropriate medium (see below). If you're not sure where it fits, it's ok, a community member will probably reply to help you with that.

Backpack communication mediums:

Please keep in mind Backpack offers no official / paid support. Whatever help you receive here, on Gitter, Slack or Stackoverflow is thanks to our awesome awesome community members, who give up some of their time to help their peers. If you want to join our community, just start pitching in. We take pride in being a welcoming bunch.

Thank you!

-- Justin Case The Backpack Robot

tabacitu commented 6 years ago

Hi @jim1506 ,

Hmmm.. that’s weird.

  1. Shot in the dark here - what happens if you wrap the action stylesheet (and JS) with a conditional? Does it fix it for you?
@if (isset($action))
    <link rel="stylesheet" href="{{ asset('vendor/backpack/crud/css/'.$action.'.css') }}”>
@endif
  1. Are you using the default create() method inside the CrudController? Or have you overwritten it in your CompanyDetailsCrudController?

Cheers!

tabacitu commented 6 years ago

@jim1506 still having the issue?

jim1506 commented 6 years ago

Yes. I would love to use Backpack but until something is solved I can't as I cannot hang around for the answer.

tabacitu commented 6 years ago

@jim1506 please answer to my questions above if you want a fix. Help us help you. Also

(3) Have you upgraded this project from a previous version of Laravel / Backpack? What version are you running? a php artisan backpack:base:version should output all the versions we need to know.

jim1506 commented 6 years ago

I have removed it from the project at the moment but I will create a new project for something else and get back to you shortly.

jim1506 commented 6 years ago

This is a side issue. If you follow your tutorial (which I am doing exactly to make sure I do not have anything incorrect) and you use the command line

php artisan backpack:base:add-sidebar-content "<li><a href='{{ backpack_url('tag') }}'><i class='fa fa-tag'></i> <span>Tags</span></a></li>"

it will generate a line that is incorrect in sidebar_content:

<li><a href='{{ backpack_url('tag') }}'><i class='fa fa-tag'></i> <span>Tags</span></a></li>

it should of course be

href="{{ backpack_url('tag') }}"

jim1506 commented 6 years ago

OK. I have changed that and just gone to add a tag and I am getting the original problem still:

ErrorException (E_ERROR) syntax error, unexpected 'stylesheet' (T_STRING), expecting ',' or ')' (View: D:\Laravel\FunAndQuotes\resources\views\vendor\backpack\crud\form_content.blade.php) (View: D:\Laravel\FunAndQuotes\resources\views\vendor\backpack\crud\form_content.blade.php) Previous exceptions syntax error, unexpected 'stylesheet' (T_STRING), expecting ',' or ')' (View: D:\Laravel\FunAndQuotes\resources\views\vendor\backpack\crud\form_content.blade.php) (0) syntax error, unexpected 'stylesheet' (T_STRING), expecting ',' or ')' (0)

jim1506 commented 6 years ago

I have just run

php artisan backpack:base:version

and got

PHP VERSION:

PHP 7.2.10 (cli) (built: Sep 13 2018 00:47:25) ( NTS MSVC15 (Visual C++ 2017) x64 ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies

BACKPACK PACKAGES VERSION:

Symfony\Component\Process\Exception\ProcessFailedException : The command "composer show | grep "backpack|laravel/framework"" failed.

Exit Code: 1(General error)

Working directory: D:\Laravel\FunAndQuotes

Output:

Error Output:

at D:\Laravel\FunAndQuotes\vendor\backpack\base\src\app\Console\Commands\Version.php:72 68| }); 69| 70| // executes after the command finishes 71| if (!$process->isSuccessful()) {

72| throw new ProcessFailedException($process); 73| } 74| } 75| } 76|

Exception trace:

1 Backpack\Base\app\Console\Commands\Version::runCommand("composer show | grep "backpack|laravel/framework"") D:\Laravel\FunAndQuotes\vendor\backpack\base\src\app\Console\Commands\Version.php:46

2 Backpack\Base\app\Console\Commands\Version::handle() D:\Laravel\FunAndQuotes\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:29

Please use the argument -v to see more details.

jim1506 commented 6 years ago

Here is the composer file which includes some items I use all the time:

"require": { "php": "^7.1.3", "appstract/laravel-blade-directives": "^1.1", "backpack/crud": "^3.4", "barryvdh/laravel-elfinder": "^0.4.1", "beyondcode/laravel-tag-helper": "^1.1", "cviebrock/eloquent-sluggable": "4.6", "davejamesmiller/laravel-breadcrumbs": "^5.1.1", "davmixcool/laravel-meta-manager": "^1.0", "fideloper/proxy": "^4.0", "freshbitsweb/laratables": "^1.0", "laravel/framework": "5.7.*", "laravel/tinker": "^1.0", "unisharp/laravel-filemanager": "^1.9" }, "require-dev": { "backpack/generators": "^1.2", "beyondcode/laravel-dump-server": "^1.0", "filp/whoops": "^2.0", "fzaninotto/faker": "^1.4", "laracasts/generators": "dev-master", "laravel/telescope": "^0.1.0", "mockery/mockery": "^1.0", "nunomaduro/collision": "^2.0", "phpunit/phpunit": "^7.0" },

jim1506 commented 6 years ago

If you want I can zip it up and send it to you

tabacitu commented 6 years ago

@jim1506 yes, please do. A db dump too, please. You can send it to hello@tabacitu.ro if it’s confidential, but let’s continue to conversation here so it’s public and someone who gets the same issue has a way to follow our progress.

Cheers!

pxpm commented 5 years ago

@tabacito the first line open up blade tags {{ and close ?> (PHP), when using blade tags {{ }} you don't use the ; (semi-colon) at the end. That might be the problem ?

tabacitu commented 5 years ago

Hmm... @pxpm were you able to replicate the problem? Happened to you too?

tabacitu commented 5 years ago

Closing this as it looks like it's user error, and doesn't have any activity in quite a while. @jim1506 , I hope you got to the bottom of this.

Cheers!