ouhare

Experience

83,360

16 Best Reply Awards

  • Member Since 3 Years Ago
  • 731 Lessons Completed
  • 0 Favorites

22nd September, 2018

ouhare left a reply on Anybody Using Vuetify? • 3 days ago

You should really check Quasar Framework, the best UI toolkit framework imo.

https://quasar-framework.org/

17th September, 2018

ouhare left a reply on Load Js Dependecy In My Bootstrap.js • 1 week ago

No, bootstrap.js is not loaded by default. You have to require it in your app.js file !

7th September, 2018

ouhare left a reply on Replacing A Large Array • 2 weeks ago

Did you try to do something like:

const newArray = await apiCall()
this.myData = [ ...newArray ]

?

23rd August, 2018

ouhare left a reply on Lazy Loading A Relationship Works, But Eager Loading Fails • 1 month ago

Is your BaseReturn class extending Illuminate\Database\Eloquent\Model ?

12th July, 2018

ouhare left a reply on Access Eloquent Relationship In Vue.js • 2 months ago

Glad to help !

ouhare left a reply on Access Eloquent Relationship In Vue.js • 2 months ago

First of all, your 'items' data should be an array :)

data () {
    return {
        items: []
    }
}

27th June, 2018

ouhare left a reply on Pass Data From Laravel To [email protected] • 2 months ago

Can you post your 'Project_model' class ?

21st May, 2018

ouhare left a reply on Not Redirecting After Submit • 4 months ago

I guess you have to redirect the user with javascript.

Try to listen for any 'success' event from dropzonejs, then redirect the user.

myDropzone.on('success', () => {
  window.location.href = "anyUrl"
})

17th May, 2018

ouhare left a reply on Search The Database But Does Not Pass The Value • 4 months ago

@foreach ($cliente as $id => $cli)
    <option value="{{ $id }}">{{ $cli }}</option>
@endforeach

14th May, 2018

ouhare left a reply on How To Hide Id From URL • 4 months ago

I guess you can use php session.

ouhare left a reply on Disable Reactivity • 4 months ago

Try to 'clone' data using lodash or Object.assign

ouhare left a reply on Invalid Argument Supplied For Foreach() • 4 months ago

Did you try to dump $request->input('hobbies')?

6th April, 2018

ouhare left a reply on How To Identify REST API Client On API-server Side? • 5 months ago

I need to know which of the API clients is making the request

Do you talk about authenticated user ? If so, you should try auth()->user()

ouhare left a reply on Search In A Multidimensional Array • 5 months ago

I will use:

function searchDataType($type, $arr) {
    $index = array_search($type, array_column($arr, 'data_type'));
    return $index > -1 ? $arr[$index] : null;
}

$found = searchDataType('USER_ID', $data);

var_dump($found);
// ['data_type' => 'USER_ID', 'data' => '2']

3rd April, 2018

ouhare left a reply on Vue Not Updating On First Element Array • 5 months ago

@nahuels Take a look a this

https://codesandbox.io/embed/1qxvy076p4?module=%2Fsrc%2FApp.vue

You don't have to use Jquery !

ouhare left a reply on Vue Not Updating On First Element Array • 5 months ago

Hello, can you post the 'isSelected' method code ?

4th March, 2018

ouhare left a reply on Sqlite 3 And HTML Checkbox Trouble • 6 months ago

Can you post the result of:

dd($request->all());

14th February, 2018

ouhare left a reply on Laravel Passport Not Respecting Oauth Refresh_token? • 7 months ago

From RFC 6749, on a refresh_token request:

...The authorization server MAY issue a new refresh token, in which case the client MUST discard the old refresh token and replace it with the new refresh token.  The authorization server MAY revoke the old refresh token after issuing a new refresh token to the client.  If a new refresh token is issued, the refresh token scope MUST be identical to that of the refresh token included by the client in the request....

ouhare left a reply on Accessor Considered As Foreign Key Defined In OneToMany Relations • 7 months ago

Why don't you use a hasOne relation for "supervisor" ?

29th January, 2018

ouhare left a reply on Laravel Echo To Window Object? • 7 months ago

ok, thank you !

ouhare left a reply on Laravel Echo To Window Object? • 7 months ago

Yes, since the key is just the public key.

Even if I authorize "Client Events" from pusher?

ouhare started a new conversation Laravel Echo To Window Object? • 7 months ago

Hello !

Is it safe to expose Echo and Pusher to the window object ?

from Laravel Echo official doc:

import Echo from "laravel-echo"

window.Pusher = require('pusher-js');

window.Echo = new Echo({
    broadcaster: 'pusher',
    key: 'your-pusher-key'
});

26th January, 2018

ouhare left a reply on Vue.js Component Rendering After Prop Update • 7 months ago

Did you try this? Answer component:

toggleSelect() {
    this.$emit('answer-selected', this.answer.id);
}

Question component

<template>
    <div>
        <quiz-answer @answer-selected="answerSelected" ... />
    </div>
</template>

<script>
...
methods: {
    answerSelected(id) {
        let i = _self.question.answers.map(item => item.id).indexOf(id);
        let answer = _self.question.answers[i];
        answer.selected = !answer.selected;
    }
}
...
</script>

21st January, 2018

ouhare left a reply on Get An Item From A Collection With Percent Rate • 8 months ago

Thank you @burlresearch ! the first implementation is perfect!

ouhare left a reply on Get An Item From A Collection With Percent Rate • 8 months ago

I'm sorry, I'm not very comfortable with that stuff.

I would like to choose one of these items bases on an "luck" rate generated with random_int.

But I realize that my data are not the best to achieve this...

ouhare left a reply on Get An Item From A Collection With Percent Rate • 8 months ago

My bad, my rates will always sum to 100, any suggestion?

$c = [
    ['id' => 1, 'rate' => 10],
    ['id' => 2, 'rate' => 10],
    ['id' => 3, 'rate' => 40],
    ['id' => 4, 'rate' => 40]
];

20th January, 2018

ouhare started a new conversation Get An Item From A Collection With Percent Rate • 8 months ago

A collection with 4 items

$c = [
    ['id' => 1, 'rate' => 10],
    ['id' => 2, 'rate' => 10],
    ['id' => 3, 'rate' => 40],
    ['id' => 4, 'rate' => 60]
];

a random number between 0, 100:

random_int(0, 100);

So, I have 10% chance to get item #1 or item #2, 40% to get #3....

How can I determine wich item to pick?

16th January, 2018

ouhare left a reply on Abort() Results In 500 Error • 8 months ago

the function abort() throws an HttpException with a status code 500 by default.

14th January, 2018

ouhare left a reply on Error : Cannot Use 'in' Operator To Search For 'length' In • 8 months ago

any errors in javascript or php ?

did you "console log" out all your data ?

ouhare left a reply on Websocket Help Needed • 8 months ago

Loook at the socket.io website !

https://socket.io/demos/chat/

7th January, 2018

ouhare left a reply on Access Data Inside Mounted VueJS • 8 months ago

@flyforever123 axios is returning a Promise (it's async) so you have to set title and call getWidth in "then" callback !

https://codepen.io/anon/pen/GyyKLN

ouhare left a reply on Access Data Inside Mounted VueJS • 8 months ago

@flyforever123 You can use "axios" to fetch your data, then set the default value in the "mounted" hook !

https://github.com/axios/axios

6th January, 2018

14th December, 2017

ouhare left a reply on How Do You Convert This To Eloquent • 9 months ago

did you try that ?

$user = User::where('id', 2)->with('stores.jobs')->first();

ouhare left a reply on How Do You Convert This To Eloquent • 9 months ago

How your user can be affected to a job ?

5th December, 2017

ouhare left a reply on OAuth W/ Grant Type=password (Resource Owner Credentials Flow) • 9 months ago

Client ID and Client Secret for password credentials grant depends on your auth server.

If you use Laravel Passport, you have already a client_id that use password credentials grant.

Just make a request with "grant", "username", "password", "client_id", "client_secret" to /oauth/token and you are good to go !

ouhare left a reply on Help Me To Refactor This Code. • 9 months ago

Why did you use $i when you have $element ?

...
foreach(request('tag_list') as $element) {
    if (!is_numeric($element)) {
        Tag::create(['name' => $element]);  
    }
}
...

ouhare left a reply on Where Are You All From? • 9 months ago

Perpignan, France !

1st December, 2017

27th November, 2017

ouhare left a reply on Updates To The Mobile App Framework Discussion • 9 months ago

I am using quasar-framework with the cordova wrapper, works well !

27th October, 2017

ouhare left a reply on Return JSON • 10 months ago

public function gethint() {
    return Company::all(['name']);
}

24th October, 2017

ouhare left a reply on Vue/ Vuex - Not Saving State Data • 11 months ago

Mutations take the module state as first argument !

mutations: {
    setInitialUserData: function(state, user){
      state.data = user;
    },
    setUserMeta: function(state, meta){
      state.meta = meta;
    },
  }

15th October, 2017

ouhare left a reply on Problem With Update Post. • 11 months ago

Try to edger load the answers:

public function edit($id) 
{
          $poll = Poll::with('poll_answer')->whereId($id)->first();
          return view('admin.polls.edit', compact(['poll', 'id']));

}

ouhare left a reply on Problem With Update Post. • 11 months ago

Can you post your Poll and PollAnswer models ?

ouhare left a reply on How Can Pass Props With Vue-router? • 11 months ago

Using the "props: true" attribute in vue-router give access to a prop called "id" in your Customer component.

export default {
    props: ['id']
    ...
}

so you can use this to make a ajax request to get your customer

14th October, 2017

ouhare left a reply on How Can Pass Props With Vue-router? • 11 months ago

You need a <router-view></router-view> in your Home component !

10th October, 2017

ouhare left a reply on Cors Error • 11 months ago

Have you tried to modify laravel-cors config and add:

'allowedOrigins' => ['http://localhost:8080']

2nd October, 2017

ouhare left a reply on Avatar Upload / Store Fail • 11 months ago

Take a look at : https://laravel.com/docs/5.5/requests#storing-uploaded-files

$path = $request->avatar->store('avatars', 'public');
Auth::user()->update([
    ...
        'avatar' => $path,
]);

28th September, 2017

ouhare left a reply on Relationship Properties Are Not Visible?! • 11 months ago

Try to capitalize the first letter of your model name (Category).

You should try edger loading children in your relation.

public function children()
{
    return $this->hasMany('App\Category')->with('children');
}

ouhare left a reply on Consuming Your API With JavaScript (Passport + VUE) • 11 months ago

Why do you use 'auth:api' middleware if you want your route to be accessible by guests ?

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.