laravel fontawesome

45

laravel fontawesome -

// In AppServiceProvider.php :
public function boot()
{
  Blade::directive('icon', fn ($expression) => "<i class=\"fas fa-{{ $expression }}\"></i>");
}

// In the blade template:
<p>
  <span>@icon('user-plus')</span>
  <strong class="text-2xl">Create user</strong>
</p>

use font awesome in laravel 8 -

npm install (if you have already, no need)npm install --save @fortawesome/fontawesome-free

Comments

Submit
0 Comments