murilo

murilo

Member Since 3 Years Ago

Ribeirão Preto

Experience Points
30,870
Total
Experience

4,130 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
253
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 7
30,870 XP
Nov
18
1 day ago
Activity icon

Replied to What Is A Good Size For A Vue Single App File ?

hello @hollyit , the problem is the first loading . have a look - http://45.32.167.126/

Activity icon

Replied to What Is A Good Size For A Vue Single App File ?

hello @fylzero ,

I am using this library - https://www.iviewui.com

It is responsible for 800 KB , of my file . Do you use Vue CLI ? Does VUE CLI has a first time loader ( that stay loading when all the code the code is loading for the first time ) ?

Activity icon

Started a new Conversation What Is A Good Size For A Vue Single App File ?

Hello , I have been working with VUE + Single Page Application . and I think that my file become very big .

my JS file has 2,000 KB . It that s very big for a file ?

When I load this website that I am building for the first time , it takes very long to load . does have any way to have a vue loader wile all the code is being loading ?

Nov
14
5 days ago
Activity icon

Started a new Conversation Laravel Vs Lumen In Single Application

Hello guys , I have been developing Single Appliication with Laravel + Vue . I start learning Lumen , and I in doubt if in my new project I start wit laravel or Lumen .

What wold be the most recommended for a single app application , Monolitic Project ( one database ) . Laravel or Lumen ? Is Lumen faster than Laravel in requests ?

Nov
08
1 week ago
Activity icon

Awarded Best Reply on I Cant Access API Route Get Via POST MAN In Laravel 6

I have solved , It was my error .

Activity icon

Replied to I Cant Access API Route Get Via POST MAN In Laravel 6

I have solved , It was my error .

Activity icon

Started a new Conversation I Cant Access API Route Get Via POST MAN In Laravel 6

Hello , I have this route -

Route::name('test')->get('test', '[email protected]');

if I add it in routes/web.php , I will be able to access my index of TestController by POST MAN . BUT if I add in routes/api.php , it will gives me 404 Error .

In Laravel 5.8 It works , but in Laravel 6 , it is not working . I dont know if I am doing something wrong . Did something changed in routes API between Laravel 5.8 to 6 ?

Thanks

Nov
07
1 week ago
Activity icon

Started a new Conversation Mesure Time Of Search In Laravel

Hello Guys I have a search in Laravel that is very big and join many tables , it bring me back a json response as result . I wold like to know if in Laravel , there is an way to know , or count the time of possessing of this search .

Thanks

Oct
10
1 month ago
Activity icon

Replied to JWT Multh Auth , With Different Models ( User Model , Customer Model )

My friends , I found the error , I forgot to add those line of code inside the Customer class -

  public function getJWTIdentifier()
    {
        return $this->getKey();
    }

    /**
     * Return a key value array, containing any custom claims to be added to the JWT.
     *
     * @return array
     */
    public function getJWTCustomClaims()
    {
        return [];
    }

Thanks a lot

Activity icon

Replied to JWT Multh Auth , With Different Models ( User Model , Customer Model )

hello @walidabou , this is the errro

Class App\Customer contains 2 abstract methods and must therefore be declared abstract or implement the remaining methods (Tymon\JWTAuth\Contracts\JWTSubject::getJWTIdentifier, Tymon\JWTAuth\Contracts\JWTSubject::getJWTCustomClaims)
Activity icon

Replied to JWT Multh Auth , With Different Models ( User Model , Customer Model )

hello @smally , I think that is better as well using all in the same model . but I will have to use this in a different model for this project . becose It is a project that It already exist like that way . I am using guards , but my question is if I implement JWTSUbject class in other model will not work like that -

use Tymon\JWTAuth\Contracts\JWTSubject;
use Illuminate\Foundation\Auth\User as Authenticatable;

class Customer extends Authenticatable  implements JWTSubject
{
    protected $table      = 'customer';
}

will give error . if I use passport class instead , it will work with 2 models ?

Activity icon

Started a new Conversation JWT Multh Auth , With Different Models ( User Model , Customer Model )

Hello I use JWT Auth , and I am trying to make a multh auth with JWT with 2 Models . (USER Model AND CUSTOMER Model ) .

Like this -

    * USER ( for ADMINS  )
         *CUSTOMER ( for CUSTOMER )

in the User model I have this code , It works -

use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable  implements JWTSubject
{
     protected $table      = 'users';
}

BUT in the modal CUSTOMER , I CAN NOT do that -

use Tymon\JWTAuth\Contracts\JWTSubject;
use Illuminate\Foundation\Auth\User as Authenticatable;

class Customer extends Authenticatable  implements JWTSubject
{
    protected $table      = 'customer';
}


It will give me error , I tried this as well -

use Tymon\JWTAuth\Contracts\JWTSubject;
use Illuminate\Foundation\Auth\Customer as Authenticatable;

class Customer extends Authenticatable  implements JWTSubject
{
    protected $table      = 'customer';
}

I was no success

Sep
29
1 month ago
Activity icon

Started a new Conversation Laravel Request , Dont Repeat Same Title

I have this laravel request -

  public function rules()
    {
        return [
                   'title'               => 'required|unique:posts' ,
    ]
}

That dont repeat the Title name in the POST , if I try to create a POST with the same title it will not aloud me .

BUT if I try to update that post , it will not aloud this title EXISTS . I have to make a request like that -

when update -
    1) If is the post , is the same one of that title . dont validate it .
        2) validate if try to make a title , different of that POST

does have any request like this in laravel ? or will I have to make a new custom class request ?

Thanks

Sep
18
2 months ago
Activity icon

Replied to Vuex , How Make A Betther Code

I wold like to implement a class inside the VUEX , I dont know if that is possible . or something like that in my VUEX MUDULES -

import CrudMuttation from "../cruds/mutation";
import CrudActions from "../cruds/actions";
import CrudGetters from "../cruds/getters";
import CrudGetters from "../cruds/getters";

const state = { 
    pageProperty : { title:'' , product:'' }  ,
        searchProperty: { title:'' }  
}

const mutations = {
    CrudMuttation 
}

const actions= {
    CrudMuttation 
}

const getters= {
    CrudGetters 
}


export default {
    namespaced:true ,
    state,
    mutations,
    actions,
    getters
}

can I do something like that ?

Sep
17
2 months ago
Activity icon

Started a new Conversation Vuex , How Make A Betther Code

Hello Guys , I wold like to know if has any way to re use codes , or expand a class inside VUEX . I know that in VUE we have mixins , but I dont know if that it is possible to use in VUEX . I have many VUEX CRUD modules . and in all those modules I have those actions ( they are the same )-

 set_filters: ({commit}) => {
  } ,
store: ({commit} , data ) => {
}
update: ({commit} , data ) => {
}
delete: ({commit} , data ) => {
}
pagination: ({commit} , data ) => {
}
search: ({commit} , data ) => {
}

What wold be the best practice to I dont repeat all those code in all those VUEX modules ?

Sep
16
2 months ago
Activity icon

Started a new Conversation Best Approach Using VUEX Modules In Vue Cruds And Not Repeat Codes

Hello Guys , I wold like to know if has any way to re use codes , or expand a class inside VUEX . I know that in VUE we have mixins , but I dont know if that it is possible to use in VUEX .

I have been working with VUEX , And I separated into modules . but I dont know if I have been working with the best approach becose I have been repeating to much codes inside VUEX MODULES .

I have many CRUDS , like those -

POST CRUD , POST_CATEGORY CRUD , POST_SUB_CATEGORY CRUD ....

and in VUEX I have those MODULES -

    post_module
    post_category_module
    post_sub_category_module
         .....
    

And in those those modules I have those codes that I repeat -


const actions = {
    set_filters: ({commit}) => {
        SAME CODE IN ALL CRUD MODULES
    } ,

    selectAll: ({commit}) => {
            SAME CODE IN ALL CRUD MODULES
    } ,
    
    changePagePagination: ({commit} , data ) => {
        SAME CODE IN ALL CRUD MODULES
} ,

store: ({commit} , data ) => {
SAME CODE IN ALL CRUD MODULES
}

update: ({commit} , data ) => {
SAME CODE IN ALL CRUD MODULES
}
delete: ({commit} , data ) => {
SAME CODE IN ALL CRUD MODULES
}

AND TO MUCH MORE .....



What wold be the best approach that ? wold be -

  1. instead use those modules , use just one module that will make everthing - CRUD_module for example ?
  2. could I use mixins inside VUEX ? I dont know if this is possible .
  3. there is and way to expland a class inside vuex , like POST_CATEGORY_MODULES expands CRUD_MODULES ... ?

Thanks

Sep
08
2 months ago
Activity icon

Started a new Conversation How Recuperate The User Id With JWT Token Inside Laravel ?

hello , I have been trying to recupareta the user ID with JWT class . this one - https://jwt-auth.readthedocs.io/en/develop/

I have this token -

eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJod…FhIn0.zPLtF5N8lKwYZslLY7l9D-0TXCPp2X4VCPY6jsyznWw

and I send this to VUE to Laravel . in Laravel I want to know the user id of this token ( the user that is logged in ) . How can I recuperate this information in Laravel ?

Thanks

Sep
07
2 months ago
Activity icon

Replied to JWT AUTH , How Can I Recuparate The User Detales In The Controller

Hello @Sti3bas , thanks so mutch for answer . do I have to send aways the token ?

It has this function , in this class -

    public function me()
    {
        return response()->json(auth('api')->user());
    }

I thought this could bring me back the USER , but it brings me NULL .

Activity icon

Started a new Conversation JWT AUTH , How Can I Recuparate The User Detales In The Controller

Hello , I am trying to work with VUE Spa Applications + Laravel .

I am trying to recuparate the user detalhes that is Logged In , in the Controller becose when I have to add a POST , I need the ID of the USER that is creating this POST .

I am making the Auth with JWT class , like this example -

https://www.youtube.com/watch?v=Jd1RW-0lQOs&list=PLJpBh2VJhy5wPhAmjDB42pkHUnqolqxxq

it is working , it makes the authenticaton , and return the user detale ,to front ( VUE ). I have those credentias in the VUE , but I dont want to pass those informations by Javascript to the BACK .

this is my authentication -

use Auth;

if(auth()->guard('api')->attempt($credentials)){
    // SUCCESSS
}

I am tryng to recuparete the user like this -

     $user = Auth::guard('api')->user();
     dd($user) ; // null
    

or

 $user = Auth::guard('api');
 dd($user) ;

// result ->
JWTGuard {#280 ▼
  #lastAttempted: null
  #jwt: JWT {#286 ▶}
  #request: Request {#43 ▶}
  #user: null
  #provider: EloquentUserProvider {#317 ▶}
}


How could I recuparate the user ID in my controller ? is that a correct approutch ?

Aug
31
2 months ago
Activity icon

Started a new Conversation Many Promisses With VUEX

Hello ,I am tryng to think the best way to do this in VUEX .

* LOAD PROMISE_A
* AFTER PROMISSE_A IS LOADED , LOAD PROMISSE B
* AFTER PROMISSE_B IS LOADED , LOAD PROMISSE C

* AFTER SHOW THE RESULT

it is something like this in Java Script I want to do

 //   Will resolve after 400ms
   let promiseA = new Promise((resolve, reject) => {
                    let wait = setTimeout(() => {
                        clearTimeout (wait);
                        resolve("PROMISSE A RUNNED FIRST");
                    }, 400)
                })


                //   Will resolve after 200ms
                let promiseB = new Promise((resolve, reject) => {
                    let wait = setTimeout(() => {
                        clearTimeout (wait);
                        resolve("PROMISSE B RUNNED AFTER");
                    }, 200)
                })

                // shows
                 Promise.all([
                    promiseA,
                    promiseB
                ]).then((res) => console.log(res))

        // RESULT IS ->  ["PROMISSE A RUNNED FIRST", "PROMISSE B RUNNED AFTER"]


IF I TRY LIKE THIS IN VUEX , MY ACTION

const actions = {
load_page: ({commit}) => {

       Promise.all([
            commit('PROMISSE_A') ,
            commit('PROMISSE_B')
        ]).then((res) => console.log(res));


    },
}

MUTTATIONS

const mutations = {
      'PROMISSE_A'(state){
        return new Promise((resolve, reject) => {
                let wait = setTimeout(() => {
                    clearTimeout (wait);
                    resolve("PROMISSE A RUNNED FIRST");
                }, 400)
        })

    } ,

    'PROMISSE_B'(state){
        return new Promise((resolve, reject) => {
            let wait = setTimeout(() => {
                clearTimeout (wait);
                resolve("PROMISSE A RUNNED FIRST");
            }, 200)
        })

    } ,

}


IT WILL RETURN

    ['undefined' , 'undefined' ]

what wold be the best way to do that in VUEX ?

Aug
25
2 months ago
Activity icon

Started a new Conversation Change The Css Of The Page In VUE SPA Project With Vue Route

Hello , I have a question . I am woring on a VUE SPA project . and I wold like to know how colud I change the style of my page ( CSS ) with the VUE route . it is that possible ?

I have 3 style of pages in my project

* Main Web Site
*Login Area
* Admin ARea

and I have in my blade , this code that Load the components (those pages )-

<div class="whapper" id="app" >
    <main-app></main-app>
</div>

and in my vue route -

  {
        path: '/contact',
        component: Contact
    } ,
  {
        path: '/admin/home',
        component: AdminHome
    } ,

Could I make something like that in my Route ? -

  {
        path: '/contact',
        component: Contact ,
    styleCSS:web
    } ,
  {
        path: '/admin/home',
        component: AdminHome ,
styleCSS:admin
    } ,
Activity icon

Started a new Conversation Use Sweet Alert Inside VUEX

Hello , I am trying to use SWEET Alert inside the vuex store file . but it does not works , it says -

TypeError: Cannot read property '$swal' of undefined"

But if I use inside my component , it works .

I am importing like this in my app.js file -

import VueSweetalert2 from "vue-sweetalert2";
Vue.use(VueSweetalert2);
Aug
24
2 months ago
Activity icon

Started a new Conversation Two Way Data Binding Form With VUEX

Hello ,I am new in VUEX . I know that for using 2 ways data binding in my form , I have to do this -

<label>Name</label>
 <input class="input" type="text"  v-model="name"  >

<label>E-mail</label>
 <input class="input" type="text"  v-model="email"  >

AND THE COMPUTED PROPERTY

 name: {
                get() {

                    return this.$store.getters['register/form']['name'];
                },
                set(value) {
                    return this.$store.dispatch('register/setForm', {value: value, name: 'name'});
                }
            } ,
email: {
                get() {

                    return this.$store.getters['register/form']['email'];
                },
                set(value) {
                    return this.$store.dispatch('register/setForm', {value: value, name: 'email'});
                }
            } ,

WELL , If my form is to big this computed property will get very BIG . could I make something like that ?

<label>Name</label>
 <input class="input" type="text"  v-model="form['name']"  >

<label>E-mail</label>
 <input class="input" type="text"  v-model="form['email']"  >

AND THE COMPUTED PROPERTY , WOLD BE SOMETHING SHORTER LIKE THIS -

form(): {
                get(FormName) {

                    return this.$store.getters['register/form'][FormName];
                },
                set(value , FormName) {
                    return this.$store.dispatch('register/setForm', {value: value, name: FormName});
                }
            } ,

Thanks

Activity icon

Replied to VUEX , Getters With The Same Name In Different Modules

I solved , it is just use this

 namespaced:true ,
Aug
20
2 months ago
Activity icon

Started a new Conversation VUEX , Getters With The Same Name In Different Modules

Hello Guys , I am trying to organilzing my projects and starting making all single applications . I have some doubt about VUEX . I am separating STORE in modules , in those modules I have getters and states with the same name , when I call it in the blade , it call all those getters without separete it . I wold like to call just a specific getter from that module . like this -

 ...mapGetters({
                name_getter: 'name_of_module/name_getter'
            })

but it is not calling like that .

THIS IS MY CODE -

STATE FILE -

import register from './modules/post';
import register from './modules/postCategory';

export default new Vuex.Store({
    modules: {
        post
    postCategory
    }

});

POST CATEGORY STATE MODULE

const state = {
    post_category: {title:'' , id:''} ,
    form_errors: {}
}

const getters = {
    form_errors: form_errors=> {
        return state.form_errors;
    } ,

POST STATE MODULE

const state = {
    post: {title:'' , id:''} ,
    form_errors: {}
}

const getters = {
    form_errors: form_errors=> {
        return state.form_errors;
    } ,

AND I CAN CALL THE GETTER LIKE THIS IN THE CONSTRUCTOR


            ...mapGetters({
                form_errors: 'form_errors'
            })

the problem that I have more than one getter with the same name ( POST / form_errors AND POST CATEGORY / form_errors ) , if I make like this , it will show just one .

I tryed like this -


            ...mapGetters({
                form_errors: 'postCategory/form_errors'
            })

but didnt work , wold be a best practice have diferent names of getters in my project ? It is that abble to reach a getter with the same name in different module ?

thanks

Aug
06
3 months ago
Activity icon

Started a new Conversation VUE Authentication Token For Many Type Of Users ( Multh Authentication )

Hello , I am starting making my application all SPA ( single page application ) , with VUE + Laravel . I have been watching some videos , I did something based on this video - https://www.youtube.com/watch?v=Jd1RW-0lQOs&list=PLJpBh2VJhy5wPhAmjDB42pkHUnqolqxxq

I have in my project a user Authentication API with JWT Class and Laravel , That I check if the user exists by his email and password . If do exists , so it returns a token , and I add this code in the header of the page with axios in VUE , like that -

axios.defaults.headers.common['Authorization'] = `Bearer ${token}`

Well , this is ok . but how do I make to have different types of users , for example -

ADMIN - USERS
CUSTOMER  - USERS

How could I prevent , the customer user to get logged in with his token , and after go to admin area and have the entire access to the admin area content ?

Jul
17
4 months ago
Activity icon

Started a new Conversation Is A Web Single Application Less Indexed For Google ?

Hello Guys , I have question . I am developing a project in Laravel + VUE . I am thinking in using VUE CLI , and make it a single web application . but in this project , I will neeed a lot to be well ranked in google . if I make it in single application . Will this website be less indexed by google ?

Thanks

Jun
18
5 months ago
Activity icon

Started a new Conversation Desabilitate Foreign Key And DROP ALL TABLES IN POSTGREE

Hello guys , I have this comman that I use in Laravel , that desabilitate foreign key , and delete .

     DB::statement('SET FOREIGN_KEY_CHECKS=0;');
        foreach (ResetMigrationTables::getAll() as $table){
            Schema::dropIfExists($table);
        }

        Schema::dropIfExists('migrations');

        DB::statement('SET FOREIGN_KEY_CHECKS=1;');

those commands works in mySQL -

DB::statement('SET FOREIGN_KEY_CHECKS=0;');
...
DB::statement('SET FOREIGN_KEY_CHECKS=1;');

IN Postgree I dint find any command like this that can desabilitate the forner key , to I delete alll I tryed this one

  Schema::disableForeignKeyConstraints();
  Schema::enableForeignKeyConstraints();

But does not work , does some one had the same problem ?

Jun
14
5 months ago
Activity icon

Started a new Conversation It Is That Possible To Gerate A New Class With A Custom Artisan Command ?

Hello Guys , I have a question . It is that possible to gerate a new class with a custom artisan command ?

I now how to create a custom command in artisan , but my question is how to gerate a PHP file . I wold like to make something like that -

    php artisan gerate:customClass

in console\Commands\gerateClass

 protected $signature = 'gerate:customClass';

protected $description = 'Gerate new Class';


 public function handle()
    {
        // create a php file
        $path = '\Classes\CustomClasses\MyClass';
        

        $class_template = '
            
            
                
             public function doThis()
                {
            ........
            }
                
        ';
}

Jun
07
5 months ago
Activity icon

Replied to Laravel Many Custom Requests

I wold like to make separated , if I make togueder , It works . but separated . I does not works .

Activity icon

Started a new Conversation Laravel Many Custom Requests

Hello Guys , I usaly make custom laravel request like this -

THIS way it works 

public function rules()
    {
        return [
            'email'                => ['required'  , new VerifyIfThisEmailDoesNotExist()] ,
            'name'              => 'required'
        ];
    }

But I am trying to use many custom classes in just one field , and it is not working . like this -

THIS way dont works 

public function rules()
    {
        return [
            'email'                => ['required'  , new VerifyIfThisEmailDoesNotExist() , new VerifyIfThisEmailisGmailAccount( ) , ] ,
            'name'              => 'required'
        ];
    }

It is only possible to use one custome class for fields ?

Jun
06
5 months ago
Activity icon

Started a new Conversation One Larave Application , Many Databases

Hello Guys , I work for a company that sells a desktop PDV Software ( a software that shows sales , process orders , taxes ... ) for companies . Well , This place that I work wants to make a online version of this software , but in this software . it has one database for each company , becose it is a huge database for each company . It is that posible to connect a laravel application with many databases , each client having one database ? It is a good approach ? Thanks