-1

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.

Franz
  • 137
  • 1
  • 5
  • 16
  • One thing I noticed is that when I put the code outside of the @section, it actually shows up on the head of the html but still doesn't work. – Franz Apr 29 '19 at 09:58

2 Answers2

0

How does your template looks like? Do you have a @yield('stylesheets') in your template?

Where is your parsley.css located?

Loko
  • 185
  • 3
  • 12
  • I don't have a @yield because it's to be used only within the same file. The parsley.css file is located inside the public folder and then under a folder named css. – Franz Apr 29 '19 at 10:01
  • When you extend from "main", you should have a @yield('stylesheets') inside of it. How does your main blade look like? – Loko Apr 29 '19 at 10:05
  • This is how my main.blade.php looks like: ```````````````````````````````````````````````````````````` ```` @include('partials._head') @include('partials._navbar') @yield('content') @include('partials._footer') ```` – Franz Apr 29 '19 at 10:06
  • try to add @yield('stylesheets') before the part – Loko Apr 29 '19 at 10:09
  • That made the css show on the page's head but the styling is still not working. Is that even possible? I opened the file itself and there are css rules in there. How come the styling aren't taking effect? – Franz Apr 29 '19 at 10:15
  • Clear cache? Run the page in developer mode in chrome and activate "disable cache" in network. – Loko Apr 29 '19 at 10:23
  • I cleared cache and disable cache but still not working. :( – Franz Apr 30 '19 at 01:18
0

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

Franz
  • 137
  • 1
  • 5
  • 16