MaverickChan

MaverickChan

Member Since 3 Years Ago

Experience Points 93,880
Experience Level 19

1,120 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 619
Lessons
Completed
Best Reply Awards 42
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.

21 May
19 hours ago

MaverickChan left a reply on Vue V-model Not Responsive

data: {
            traffic:''
        }

in template

<select v-model="traffic">
        <option value="all" selected="selected">All</option>
        <option value="organic">SEO traffic</option>
        <option value="social">Social media</option>
    </select>

17 May
4 days ago

MaverickChan left a reply on Logout In Laravel Not Working

@CRONIX - it is the default app.blade.php , and it HAS a href="{{ route('logout') }}" ,just noticed. No use , but it is there.

i think it is a bootstrap jquery issue.

MaverickChan left a reply on Logout In Laravel Not Working

@IRANKHOSRAVI - i AM giving you a JQUERY answer

MaverickChan left a reply on Logout In Laravel Not Working

@IRANKHOSRAVI - if you are using jquery(i am more comfortable with Vue, but it is ok)

  1. in your layout file's tag add a line
@stack('testscript')

  1. in your blade file , add a line
<a herf="#" id="testlogout">testlogout</a>

  1. at the end of the blade file add :
@stack

<script>

    $(document).ready(function(){

        $('#testlogout').click(function(e){

    e.preventDefault();

    var url = "{{ route('logout') }}"

    $.ajax({

    type:"POST",

        url:url,

     headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')},

    success: function() {

        console.log('logged out');

}

});

})


})


</script>


@endstack

correct me if i am wrong , you can give it a try.

MaverickChan left a reply on Logout In Laravel Not Working

@IRANKHOSRAVI - seems like it . Because jquery taking control of getElementByid , if this function broke , you will never submit a logout button.

Or , you can write a custom logout function to test it.

MaverickChan left a reply on Data Is Not Deleting In Laravel

@PROGRAMMER111 - methods: { deleteUser(id){

    var vm = this

        Swal.fire({
                title: 'Are you sure?',
                text: "You won't be able to revert this!",
                type: 'warning',
                showCancelButton: true,
                confirmButtonColor: '#3085d6',
                cancelButtonColor: '#d33',
                confirmButtonText: 'Yes, delete it!'
            }).then((result) => {

            //send request to the server

                vm.form.delete('api/user/'+id).then(()=>{
                    Swal.fire(
                    'Deleted!',
                    'Your file has been deleted.',
                    'success'
                        )
                }).catch(()=>{
                    swal("Failed!", "There was something worng.", "warning");
                });
                
                })
        },
    }

MaverickChan left a reply on Logout In Laravel Not Working

@IRANKHOSRAVI - what do you mean you cannot logout?

you are using default laravel auth layout file , it should have done the job perfectly.

Have you tried refresh your page? Like a hard refresh?

or , do some as below:

php artisan cache:clear

php artisan view:clear

then refresh again.

MaverickChan left a reply on Logout In Laravel Not Working

delete the href

16 May
5 days ago

MaverickChan left a reply on Can't Write Image Data To Path In Production Server [Interverntion Image ]

@JAIKANGAM - did you create the webinar folder manually?

maybe you should delete it , leave it blank , let laravel do the job.

give it a try

MaverickChan left a reply on Laravel + Vue.js: [Vue Warn]: Failed To Mount Component: Template Or Render Function Not Defined.

Vue.component('example-component', require('./components/ExampleComponent.vue').default);

something like that.

MaverickChan left a reply on Can't Write Image Data To Path In Production Server [Interverntion Image ]

@JAIKANGAM - alright , change the ownership of folder webinar too , then try again

15 May
6 days ago

MaverickChan left a reply on Can't Write Image Data To Path By The Intervention

@JAIKANGAM - strange , my code works fine on both my mac and ubuntu

then change ownership , it is more secure . or contact your domain service provider

just google it , i cannot know your user name , so , you have to do it by yourself.

good luck

MaverickChan left a reply on Can't Write Image Data To Path By The Intervention

@JAIKANGAM - if you don't care the safety issue(chance is very rare) , you can also change the permission .

cd into your public path

sudo chmod -R 777  images

MaverickChan left a reply on How To Add Pagination To This Code

@MICHALIS - you should copy @andreich1980 's code , don't add get() in it and don't change a thing , then magic

MaverickChan left a reply on Can't Write Image Data To Path By The Intervention

@JAIKANGAM - ok , seems like you are using a linux server ,

change the images folder ownership to yourself then everything should be fine.

or , remove public_path , just the relative path string.

MaverickChan left a reply on Can't Write Image Data To Path By The Intervention

@JAIKANGAM - the file directory , bigfile , you need to create it

and check your form , make sure this line exist

enctype="multipart/form-data"

MaverickChan left a reply on Can't Write Image Data To Path By The Intervention

@JAIKANGAM - ``` if($request->hasFile('webinarphoto')){

//first we have file , ok , let us store it somewhere , why not? You upload it , treat it good...

        $file1 = $request->webinarphoto;

    $path = 'images/webinar/bigfile/' . $file1->getClientOriginalName(); 

    $file1->move(public_path($path);

    //then start resizing


    $image = Image::make($path);

    $filename = time().'.'. $file1->getClientOriginalExtension();

    $location = public_path('images/webinar/' .$filename);

    $image->resize(500,500)->save($location);

      }

MaverickChan left a reply on SQLSTATE[42S22]: Column Not Found: 1054 Unknown Column

your lecturer model has a wrong relationship

a user can have a lot of lectures , so the reverse relationship is :

some lecture belongs to a user

so , should be

public function user(){
      return $this->belongsTo('PMS\User');
    }

MaverickChan left a reply on Can't Write Image Data To Path By The Intervention

before resizing , move your file first

$file1->move(public_path('images/webinar/bigfile/'), $file->getClientOriginalName());

Image need to know which file to resize

14 May
1 week ago

MaverickChan left a reply on Working With Pagination And Infinite Loading

@CHRISGRIM - Yes , you don't have to . Many of the logics is in the Model, controller just do some dispatch work.

for example:

in controller , just one action

public function dataviewer () {

        return response () 

            ->json([

                'collection' => Post::AdvancedFilter()

            ]);

    }

in my Model

public function scopeAdvancedFilter ($query) {
    
    // $query is for data query such as searching , selection , you need to write your own
    //you can do more in this part , such as chained orderby , paginate, just return a collection , and done

    }
13 May
1 week ago

MaverickChan left a reply on Working With Pagination And Infinite Loading

in my controller , i return a collection as json object

you can change the name to event

    
    export default {

        mounted () {

            this.getPosts ()

        }

        props : {

            url: String,

        },

        data () {

            return {

                collection : {

                    data : []

                },

                query: {

                    

                    limit: 10,

                    page: 1

                },


            }

        },

        
        methods : {

            getPosts () {

                const params = {

                    ...this.query

                }

                axios.get(this.url , {params : params})

                    .then(

                            response => {

                                this.collection = response.data.collection

                                this.query.page = response.data.collection.current_page

                            }

                        )

                    .catch((error) => {



                    })


                    .finally(() => {

                        

                    });

            },

            

            

            

            changePerpage () {

                this.query.page = 1

                this.getPosts ()

            },

            nextPage () {

                if (this.collection.next_page_url) {

                    this.query.page = Number(this.query.page) + 1

                    this.getPosts ()

                }

            },

            prevPage () {

                if (this.collection.prev_page_url) {

                    this.query.page = Number(this.query.page) - 1

                    this.getPosts ()

                }

            },

        }


    }

12 May
1 week ago

MaverickChan left a reply on Something About Jeffery's Twitter

@MTHOMAS - oh , i see , thanks pal

11 May
1 week ago

MaverickChan started a new conversation Something About Jeffery's Twitter

Can anyone double check Jeffery's Twitter?

All tweets are gone. And the description says 'i am error'

what happened?

MaverickChan left a reply on Please Share Your Apache Configuration For LARAVEL

@VANDYCZECH - ``` <VirtualHost *:80> DocumentRoot "/Library/WebServer/Documents/blog/public" ServerName localhost Options FollowSymLinks Multiviews MultiviewsMatch Any AllowOverride All Require all granted this works fine on Mac Os , but if you are using Ubuntu , it should be like blow:

<VirtualHost *:80> DocumentRoot "/var/www/html/blog/public" ServerName localhost <Directory /var/www/html/blog/public> Options FollowSymLinks Multiviews MultiviewsMatch Any AllowOverride All Require all granted

10 May
1 week ago

MaverickChan left a reply on Vue.js - Sending A Message

@TRINITYMH - what do you mean :

After posting this amendment, you do not want to send text.

and , in my opinion , you did not describe your question clearly

MaverickChan left a reply on Unhandled Promise Rejection: TypeError: Undefined Is Not An Object (evaluating 'response.data')

 <a :href="'/notendur/'+data.owner.username">

above line is not right

i don't think you should use data as a prop name.

change it to another name like userdata or something else.

09 May
1 week ago

MaverickChan left a reply on How To Pass User Info Into Vue

there is no user info , if it is a guest status.

you can use if statement in blade

MaverickChan left a reply on Vue.js - Sending A Message

new Vue({
  el: '#consoleCM',

  data: {
    newItem: { 'consoleC': '' },
  },
  methods: {
    createItem: function createItem(message) {
          var input = this.newItem;

          axios.post('/vueitems/command', input).then(function (response) {
            this.newItem = { 'idC': message, 'consoleC': '' };
          });
      },
  }
});
06 May
2 weeks ago

MaverickChan left a reply on Laravel Passport Tokens Tables With Thousands Of Rows

instead of revoke , you can also do delete when log out , this will remove the token row in database

public function logout (Request $request) {

        auth()->user()->tokens->each(function ($token,$key) {

            $token->delete();

        });

        $response = 'You have been succesfully logged out!';
        
        return response($response, 200);

    }

04 May
2 weeks ago

MaverickChan left a reply on How To Fix 500 And 429 Errors With Axios ?

500 could be anything of server side. Open browser dev tools , see network tab error message.

BTW , don't put everything in mounted , or extract to dedicated methods.

for example

mounted () {

    this.getItems ()

    this.getDashboard ()

},

methods: {

    getItems () {

        axios.get(url)
            .then(response => { do something})
            .catch(error)
            .finally(() => {do something})  

    },

    getDashboard() {same like above}

}





01 May
2 weeks ago

MaverickChan left a reply on What Is This Property Name Mean In Component File

@RESPECT - proper or property??

are trying to ask what the NAME means?

name is for the component itself

MaverickChan left a reply on How To Manage The Route Between Index That Returns A View Or A List Of Data With Laravel And Vue

@MIGUELCARRANZA - Laravel has a helper function called 'wantsJson()',

you can write in controller like this:


if (request()->wantsJson()) {

    return $posts;

}

return view('post',[

    'posts' => $posts

])

MaverickChan left a reply on What Is This Property Name Mean In Component File

export default {

    props:['someProperty'],

    data () {

        return {

            }
    
        },

}
28 Apr
3 weeks ago

MaverickChan left a reply on Using Vue To Authenticate With Laravel/passport?

@NEEONLINE - yes , hard(not that hard) part is understand how to get the token and store it .

my advice is , when login , get the token generated by laravel , store it in Localstorage

every page need auth , should check if the token exists

those pages need send a header with bearer auth token

i cannot give you the whole code , but little google would help

vue-router doc has some solutions , please check it out

Happy coding

MaverickChan left a reply on Vue.js Implement Vue-star-rating With Laravel 5.8 Project

@CALLUMCARLSTROM - the other way is , don't put those lines in the app.js

in some component you wish to use vue-star-rating

import starRating from 'vue-star-rating'

export default {

    components: {

        starRating, 

    }

}
27 Apr
3 weeks ago

MaverickChan left a reply on Using Vue To Authenticate With Laravel/passport?

@NEEONLINE - yes , you can find it on Medium.

Actually it is not that hard

MaverickChan left a reply on Vue.js Implement Vue-star-rating With Laravel 5.8 Project

@CALLUMCARLSTROM - did you install vue-star-rating through npm?

MaverickChan left a reply on Vue.js Implement Vue-star-rating With Laravel 5.8 Project

@CALLUMCARLSTROM - not right.

in your app.js , you've already global registered the example-component

but , not register the vue-rating right and not imported

try this

app.js

/**
 * First we will load all of this project's JavaScript dependencies which
 * includes Vue and other libraries. It is a great starting point when
 * building robust, powerful web applications using Vue and Laravel.
 */

require('./bootstrap');

window.Vue = require('vue');

import StarRating from 'vue-star-rating'

/**
 * The following block of code may be used to automatically register your
 * Vue components. It will recursively scan this directory for the Vue
 * components and automatically register them with their "basename".
 *
 * Eg. ./components/ExampleComponent.vue -> <example-component></example-component>
 */

// const files = require.context('./', true, /\.vue$/i)
// files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default))

Vue.component('example-component', require('./components/ExampleComponent.vue').default);

Vue.component('star-rating',StarRating.default);

/**
 * Next, we will create a fresh Vue application instance and attach it to
 * the page. Then, you may begin adding components to this application
 * or customize the JavaScript scaffolding to fit your unique needs.
 */

const app = new Vue({
    el: '#app',
    
});


26 Apr
3 weeks ago

MaverickChan left a reply on Creating Non Reactive Copies Of Vue Data

why not simply reset everything by refresh the page?

MaverickChan left a reply on Odd Image Upload Issue

@MATTB - the $path='../public/images' is really not right

change it to '/images',

because where you upload to , is public. When you use '../public' it turns to 'public/public', so you will never find your image.

MaverickChan left a reply on Odd Image Upload Issue

@MATTB - just add a / before image

$path = '/images';

delete the line inside

$path = '../public/images'

you don't need it

25 Apr
3 weeks ago

MaverickChan left a reply on Vuejs Vs JQuery

But on occasions, the data is retrieved but not displayed correctly.

Please define not displayed.

And , speaking of the running speed .... hum , it is not always right. Vue could be very fast , and in some case , jQuery could be slow as well

MaverickChan left a reply on Trouble Understanding How A Vue Plugin Is Working

@DUNSTI - no , he is using laravel built-in vuejs , not vuecli.

24 Apr
3 weeks ago

MaverickChan left a reply on Passing The Api_token In Header When The User Log In

@EMFPC - 1.log in and get the api_token 2.store in the localstorage 3.next time check localstorage hasToken? true and get from localstorage : false to redirect 4.send the api_token in headers through ajax call such like axios ,any page need auth could now do the check

  1. when log out , clear localstorage

MaverickChan left a reply on Vue CLI 3

put these line in your main.js


window.Popper = require('popper.js').default;

try {
    window.$ = window.jQuery = require('jquery');
    require('bootstrap');
} catch (e) {}

after

import bmd from 'bootstrap-material-design';

then run npm run dev in the command line

don't forget to npm install jquery popper.js --save first

23 Apr
4 weeks ago

MaverickChan left a reply on Vue CLI 3

which scripts?

import anything from 'anything'