Search code examples
laravellaravelcollective

{!! Html::style('css/parsley.css') !!} NOT WORKING


I'm new to Laravel and I also understand that Laravel has stopped supporting Collective but I managed to still install the package into my Laravel 5.8 project.

Now my problem is, when I tried adding the line below, it does not work. When I inspect element, it's not showing in the head section of the page.

{!! Html::style('css/parsley.css') !!}

Do you think it has something to do with the fact that Laravel no longer supports Collective or I'm doing something wrong here?

Thank you so much for your help guys!

I also tried using <link href="{{ asset('css/parsley.css') }}" rel="stylesheet"> BUT STILL NOT WORKING.

This is the code of the whole page I'm working on.

@extends('main')

@section('title', '| New Post')

@section('stylesheets')
    {{-- {!! Html::style('css/parsley.css') !!} --}}
    <link href="{{ asset('css/parsley.css') }}" rel="stylesheet">
@endsection

@section('content')
    <div class="jumbotron">
        <div class="container">
            <h1 class="display-4">Create New Post</h1>
            <p class="lead"></p>
            <hr class="my-4">
            <p>Fill out the fields to write your post.</p>
            {{-- <a class="btn btn-primary btn-lg" href="#" role="button">Learn more</a> --}}
        </div>
    </div>
    <div class="container">
        <div class="col-sm-12 col-md-12">
            {!! Form::open(array('route' => 'posts.store', 'data-parsly-validate' => '')) !!}
                {{ Form::label('title', 'Title:') }}
                {{ Form::text('title', null, array('class' => 'form-control', 'required' => '')) }}

                {{ Form::label('body', 'Body:') }}
                {{ Form::textarea('body', null, array('class' => 'form-control', 'required' => '')) }}

                {{ Form::submit('Create Post', array('class' => 'btn btn-success btn-lg btn-block mt-2')) }}
            {!! Form::close() !!}
        </div>
    </div>

@endsection

@section('scripts')
    {!! Html::script('js/parsley.min.js') !!}
@endsection

I expected the parsley.css and parsley.min.js be imported into the page but it didn't work.


Solution

  • I fixed the problem. I had to remove the Collective codes and back to basic to make it work.