menu

arrow_back Blade and error?

by
1 vote
I'm trying to create my own directive, but PHP decided to give me THIS error. How to correct it?

/app/Providers/AppServiceProvider.php:
<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Blade;

class AppServiceProvider extends ServiceProvider
{
public function boot()
{
Blade::component('particlas.modal', 'modal');
view()->composer('particlas.modal', function ($view) {
$view->with('test', 'test');
});
Blade::directive('ifTest', function () {
return "<?php if(!1>2): ?>";
});
}
}

4 Comments

Ilya ,
Blade::if('ifTest', function () {
return 1 != 2;
});
?

1 Answer

by
 
Best answer
0 votes
<?php if(!1>2): ?>

Well, what do you want? Insert such a line in any code and it will crash with the same error.
It should be a complete working code.

And this is how you get it into the template if(1=2) { without the closing parenthesis.