dhaval

dhaval

Member Since 2 Years Ago

Experience Points
3,220
Total
Experience

1,780 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
30
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start-engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-session Created with Sketch.

    School In Session

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

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

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

  • subscriber-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist Created with Sketch.

    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 Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

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

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

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

Level 1
3,220 XP
Jan
16
2 years ago
Activity icon

Started a new conversation How To Get Slug From Url ?

let me explain with example on that I am working.My project is in laravel 5.3.

when I open http://localhost/gift_india/brand/baskin-robbins url it's call brand_detail.blade.php file so on this url baskin-robbins is my slug. so I want to pass baskin-robbins to vue js and want to get data for this brand item.

brand_detail.blade.php file

<brand-detail></brand-detail>

@{{detail}}

brand_detail.js file

Vue.component('brand-detail', {

template: '#brand-detail-template',

data: function(){

return {

    detail: []

}

},

created: function(){ var slug = this.$route.params.slug; // here I'm getting error that Uncaught TypeError: Cannot read property 'params' of undefined console.log(slug);

axios.get('brand_detail/:slug')
    .then(function (response) {
        console.log(response.data);

    })
    .catch(function (error) {
        console.log(error.data);
    });

} });

new Vue({

el: '#container_detail'

})

In my blade_detail.blade.php file I have include below js files.

How can I get this ?

Jan
12
2 years ago
Activity icon

Started a new conversation How To Create Href Link From Vue Js Response

let's start with example that I am developing in my project. My project in laravel so below example is in blade file.

using Vue js I get response and set in template structure.

<ul>
    <li v-for="brand in list">
        @{{brand.name}}
        <a href="#"> // how to create href url from brand name that come from Vue response and I want to replace space with dash from brand name and pass to href url

                           <img :src="brand.image">

                   </a>

    </li>
    
</ul>

let's assum that I am getting brand.name = test demo

And using this brand.name I want to build href url like this : href = "brand/test-demo".

One more thing I want to complete is :

Want to pass this href link to other Vue http request like

created: function(){

    axios.get('brand/test-demo').then(response => this.detail = response.data) ;

}  

How to do these think ? I don't have any idea ? any help would be great.

Thanks

UPDATE :

I have tried below methods but none of working.

href="{{url('brand/' + brand.name}}

href="{{url('brand/'}} + brand.name

But when I pass full URL it's work like :

href="'http://localhost/gift_india/' + brand.name "> // this one work but I want dynamic URL.

Jan
11
2 years ago
Activity icon

Replied to This.$http.get Is Not Working

@saqueib

Can you tell me where I need to add code that you suggest me. in brand.js file?

Activity icon

Started a new conversation This.$http.get Is Not Working

I am trying to use Vue js for laravel project. this is first time I am using Vue js.

brand.blade.php

        <brands></brands>

    </div>

    <template id="brand-template">

        <ul>
            @{{ list.count }}
            <li v-for="brand in list.brand"> @{{ brand.brand_id }}  </li>

        </ul>

    </template>

brand.js

Vue.component('brands',{

template: '#brand-template',

data: function(){

    return{

        list: []
    }

},

created: function(){

    this.$http.get('api/brands', function(brand){ // if I use $.getJSON('api/brands', nction(brand){ it's working perfect

        console.log(brand);
      this.list = brand;

    }.bind(this));

}

}); new Vue({ el: '.container' })

can anyone help me?

I have also include Vue js and Vue-resource js

Jan
05
2 years ago
Activity icon

Replied to How To Work With Monolog-mysql ?

@gator think that you tell here that :

NOTE: The creator of Monolog details why using mysql as the sink for logging is a bad idea: http://stackoverflow.com/questions/15593010/can-laravel-4-log-to-a-mysql-database. Be sure to review and take that into consideration.

I appreciate you for suggest me good point but can you tell me how to use redis for storeing all monolog ? any reference link would be helpful.

because I do know about redis but don't know anything about monolog with redis storage.

Activity icon

Started a new conversation How To Work With Monolog-mysql ?

I'm developing project in laravel. My need is to store monolog in mysql database so I install "wazaari/monolog-mysql" package using composer. But I don't know how to work with this package. So I give one try but no success.

BrandController.php (controller file)

class BrandController extends Controller{

 protected $brand;

public  function __construct(Brand $brand,AccessToken $token){
    $this->brand = $brand;
    $this->token = $token;
}

public function get_brand(){

        $brands = $this->brand->get_all_brand();

        return View::make('brands')->with('brands', $brands);

}

}

Brand.php (model file)

class Brand{

protected $connection = null;

/**
 * Database Connection
 */
public function __construct(){

    $this->connection = DB::connection()->getPdo();

    //Create MysqlHandler
    $mySQLHandler = new MySQLHandler($this->connection, "log", array('username', 'userid'), \Monolog\Logger::DEBUG);

    //Create logger
    $logger = new \Monolog\Logger($context);  // get error here...
    $logger->pushHandler($mySQLHandler);
}

public function get_all_brand(){

    $select = "SELECT
               b.brand_id,
               b.brand_name,
               b.image,
               b.hash,
               GROUP_CONCAT(bp.p_name) AS price,
               GROUP_CONCAT(bp.p_skuId) AS sku,
               GROUP_CONCAT(bp.p_type) AS type,
               GROUP_CONCAT(bp.p_valueType) AS valuetype
               FROM
               brands AS b
               LEFT JOIN
               brand_price AS bp ON b.hash = bp.hash
               GROUP BY  b.brand_id
               ";
    $sth = $this->connection->prepare($select);
    $sth->setFetchMode(PDO::FETCH_ASSOC);
    $sth->execute();
    $status = $sth->fetchAll();

    $this->$logger->addWarning("This is a great message, woohoo!", array('username'  => 'John Doe', 'userid'  => 245));

    return $status;



}

}

Abouve is my code for get all brand and if there is any issue it wil add recored in mysql log table but it's not working and I get error.

below error I got :

ErrorException in Brand.php line 29: Undefined variable: context

I am not getting what is $context and how to defind it.

please help.