Laravel not formatting 3rd party package - laravel

I've recently set up my Laravel 5.7 project with GIT. I did a clone onto a new computer and ran composer install. I keep getting a syntax error (T_CONSTANT_ENCAPSED_STRING).
I'm using a Upgraded version of Laravel 5.7(started at 5.1). Using the Bican Roles package to manage roles on the site.
I've tried reinstalling and uninstalling the package. Also tried wrapping it with double parentheses. (thats the part not formatting). all to no avail
//before rendering in app.blade.php
#role('admin')
// after rendering
<?php if (Auth::check() && Auth::user()->is'admin'): ?>
Errors I'm getting when trying to load the page.
syntax error, unexpected ''admin'' (T_CONSTANT_ENCAPSED_STRING) (View:
C:\wamp64\www\dashboard\resources\views\app.blade.php) (View:
C:\wamp64\www\dashboard\resources\views\app.blade.php) Previous
exceptions syntax error, unexpected ''admin''
(T_CONSTANT_ENCAPSED_STRING) (View:
C:\wamp64\www\dashboard\resources\views\app.blade.php) (0) syntax
error, unexpected ''admin'' (T_CONSTANT_ENCAPSED_STRING) (0)

This part leads to error: Auth::user()->is'admin'
It should be Auth::user()->is('admin'). You should check the code where the Blade directive #role is defined.

Related

Vuejs3 + laravel 8 working find locally but in prod vuejs files throwing syntax error and view not render Uncaught SyntaxError: 59

build a project using Vuejs 3 in Laravel 8 went running on Laravel server it works well but went I run npm run prod and deploy it in Cpanel compilation fails with Uncaught SyntaxError: 59 in the console I have remove style and script tags from blade file but still have a problem. please I really need your help
Please check your final html code. May be there you will find a <style>...</style> or <script>...</script> tags... These are the main problem of Uncaught SyntaxError: 59. Yes, it will be ignored in local and development environment but won't in production one...
For example:
<div id="app">
<script>
alert('yes');
</script>
</div>
The main idea to put script and style tags out of the div#app element.

Laravel 5.3 Collective not installing

I'm learning how to work with forms but I got an error on the first try when I tried simple html code.
<form class="form" method="post" action="{{url('/painel/produtos/store')}}">
With this code I got this error:
MethodNotAllowedHttpException in RouteCollection.php line 218:
So I searched around and find out that people use this code instead
{{ Form::open(array('url' => '/painel/produtos/store')) }}
And I got a new error which is Class 'Form' not found so i searched and found that I would need Laravel Collective but when I try to install it it gives me this error:
[UnexpectedValueException]
Could not parse version constraint :5.3.0: Invalid version string ":5.3.0"
So I dont know what to do more.
Hello you can try this.
But the project has abandoned.
composer require "laravelcollective/html"::"^5.3.0"

Blade Template Engine - Jenssegers blade

ı want to use blade template engine without laravel. I install this https://github.com/jenssegers/blade but don' t use this.
My index.php :
require 'vendor/autoload.php';
use jenssegers\blade;
$blade = new Blade('views', 'cache');
echo $blade->make('homepage', ['name' => 'John Doe']);
?>
ı have a error :
PHP Fatal error: Uncaught Error: Class 'jenssegers\blade' not found in /var/www/html/index.php:8
Stack trace:
0 {main} thrown in /var/www/html/index.php on line 8
For the record, this error is caused by the folder where the library was installed. They updated the composer.json for this reason. As a sidenote: psr-0 and psr-4 are broken, and it's one of the cause. I had the same problem with a couple of libraries.
Anyways. You can try this one: (one class, no dependency, 100% performance friendly, and it's updated).
https://github.com/EFTEC/BladeOne/
(Disclaimer: I am the author and it's free for the community)

PHP Fatal error: A precedence rule was defined for > Illuminate\Foundation\Auth\AuthenticatesUsers::getGuard

I've just finished updating an app from Laravel 5.1 to 5.2. Everything is working fine on my local Homestead install. When I deploy to my forge server, the process is failing with the following error:
PHP Fatal error: A precedence rule was defined for
Illuminate\Foundation\Auth\AuthenticatesUsers::getGuard but this
method does not exist in
/home/forge/myapp/vendor/laravel/framework/src/Illuminate/Foundation/Auth/AuthenticatesAndRegistersUsers.php
on line 11
What could be causing this? I've tried running composer dump-autoload after the update, but still no luck.
Any advice appreciated.
I fixed this by deleting /bootstrap/cache/compiled.php. The files the error refers to were fine.
The AuthenticatesAndRegistersUsers has a precedence statement to use getGuard from AuthenticatesUsers instead of from RegistersUsers.
The AuthenticatesUsers trait has a getGuard method defined in it.
Double check to make sure your version of that trait has the getGuard method and or double check those traits against the ones in the laravel repository.

Laravel new command error

I did the following commands:
composer global require "laravel/installer=~1.1"
and
set PATH=%PATH%;%USERPROFILE%\AppData\Roaming\Composer\vendor\bin
But when I try to do:
laravel new blog
I get the following error:
Notice: Undefined variable: output in C:\Users\****\AooDara\Roaming\Composer\vendor\laravel\installer\src\NewCommand.php on line 55
Fatal error: Call to a member function writeln() on null in C:\Users\****\AooDara\Roaming\Composer\vendor\laravel\installer\src\NewCommand.php on line 55
Any idea of what went wrong?
Seems like you already have a directory called 'blog' in your application directory. Try creating a laravel app with different name or delete / rename existing 'blog' directory and try again.
for example laravel new helloapp.
However, I think the error showing at the console is a bug of laravel new command. I could see the error at the console when I tried to create a app with same name again from same directory.
The error not exists now. Try creating other application.

Resources