kundefine

kundefine

Member Since 9 Months Ago

Dhaka

Laravel Developer at ColourSpray

Experience Points 120
Experience Level 1

4,880 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed 0
Lessons
Completed
Best Reply Awards 0
Best Reply
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • Chatty Cathy Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

19 May
6 hours ago

kundefine left a reply on Laravel: Dynamically Add And Remove CSS Or Script

@SNAPEY - I know i can do that. But what if i don't need some master css file in pages. include is easy but how to exclude.

@extends('dashboard.layouts.master')

@section('page-css')

    {{-- add any additional css for index page ==}}

@endsection

@section('exclude-css')

    {{-- remove any css that comes from master layout ==}}

@endsection


@section('main-content-section')

@endsection


@section('script')
@endsection
18 May
1 day ago

kundefine left a reply on Laravel Share Variable In All Views As Reference

@BOBBYBOUWMANN - @bobbybouwmann that doesn't work for me. I added a new thread what i really want to do https://laracasts.com/discuss/channels/laravel/laravel-dynamically-add-and-remove-css-or-script pls give any feedback if you have any.

kundefine started a new conversation Laravel: Dynamically Add And Remove CSS Or Script

It is really easy to include all the common CSS or Script in the page. But the problem arise when you don't need some CSS or Script in the page. If you checkout my below code you will find out what i am trying to say.

I already instantiate my CSS class in header.blade.php and its included in the master.blade.php. After that index.blade.php extends master.blade.php

But the problem is When index.blade.php render it's create a new instance of the CSS class. header instance is gone.

I am trying to use my CSS Class

=> as service provider
=> share as view variable
=> as a Facade
  1. CSS.php (myclass for add or remove css)
namespace App\AppGlobal;

class CSS {
    public $css = []; // all my css filename and path is store in here

    // add css
    public function add($path, $filename) {
        $path = asset($path);
        $this->css[$filename] = $path;

        return $this->css;
    }


    // remove css
    public function remove($filename) {
        if(array_key_exists($filename, $this->css)) {
            unset($this->css[$filename]);
        }
    }

    // print css
    public function print() {
        $output = '';
        if(count($this->css)) {
            foreach($this->css as $filename => $path) {
                $output .= "<link rel='stylesheet' href='{$path}/{$filename}'>\n";
            }
        }
        echo $output;
    }
}

  1. master.blade.php (look like below)
{{-- include tha header --}}
@include('dashboard.inc.header')

{{-- the main content section --}}
@yield('main-content-section')

{{-- include tha footer --}}
@include('dashboard.inc.footer')
  1. header.blade.php (look like below)
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>{{config('app.name', 'ColorSpray')}}</title>

    {{-- add all common css --}}
    <?php $css->add('some/path', 'filename.css') ?>
    {{-- add additional css--}}
    @stack('add-css')
    {{-- remove exitsing css--}}
    @stack('remove-css')
    {{-- print all my css --}}
    <?php $css->print(); ?>
</head>
<body>
  1. index.blade.php (index.blade.php extends master.blade.php)
@extends('dashboard.layouts.master')

@push('add-css')
    {{-- add any additional css for index page --}}
    <?php
        $css->add('your/path/name', 'filename.css');
    ?>

@endpush

@push('remove-css')
    {{-- remove any common css that i don't need in index page --}}
    <?php
        $css->remove('your/path/name', 'commonFilename.css');
    ?>
@endpush


@section('main-content-section')

@endsection


@section('script')
@endsection
16 May
3 days ago

kundefine started a new conversation Laravel Share Variable In All Views As Reference

I really want a very simple thing

  1. I Share a global variable from AppServiceProvider like below
public function boot() {
    view()->share('css', new CSS());
}
  1. I set some property values it In a View (index.blade.php) like blow
$css->publicProperty = "Something"; // changed in index.blade.php
  1. In another View (contact.blade.php) i check the $css->publicProperty variable but it doesn't give me the change value
dd($css->publicProperty) // give me the initial value in contact.blade.php

Now i need a way that share a variable as global also as reference. So that i change in one view and it will retain the change in other views also