ouhare

ouhare

Perpignan, France

Member Since 3 Years Ago

Experience Points 89,400
Experience
Level
Lessons Completed 779
Lessons
Completed
Best Reply Awards 18
Best Answer
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.

03 Oct
2 months ago

ouhare left a reply on Add To Cart Qty Not Working,

@tehseen What happen if your $item already exists in your $this->items array ? You can set $qtywith any number you want, it will pick up the quantity of $this->items[$id].... I guess

ouhare left a reply on Add To Cart Qty Not Working,

when i pass third parameter $qty in my add function

Where is your third parameter? public function add($item, $id)

01 Oct
2 months ago

ouhare left a reply on Ajax Not Sending Data To Controller

@rory

You are using inside your form

<input type="hidden" name="_token" id="token" value="{{ csrf_token() }}">

You can replace it with {{ csrf_field() }}.

then, you can try this instead:

var formdata =  $('#sistrixKw').serialize();
$.post('/sistrix', formdata, function (response) {
    console.log(response)
});

ouhare left a reply on How To Get Value/Data In Dropdown Options, That I Have Inserted Into Table...?

did you pass your $allbus variable to your view?

ouhare left a reply on Ajax Not Sending Data To Controller

data: { 'formdata' : formdata, "_token": $('#token').val() }

Try this (without the quote)

28 Sep
2 months ago

ouhare left a reply on Can You Explain This Code

$role is the "parameter" passed through 'Role:0'. In this case, it's 0.

ouhare left a reply on Policy Is Not Registering

Try to use the Gate facade instead.

use Illuminate\Support\Facades\Gate;

Gate::define(...)

You don't have to set it within boot method.

ouhare left a reply on How To Use Show($id) With Foreign Key Relationship?

$engagement = Engagement::with('client')->find($id);

ouhare left a reply on Can You Explain This Code

if ($request->user()->role < $role) {
    return abort(404);
}

You've got your response !

ouhare left a reply on Policy Is Not Registering

Policies have to be registered in AuthServiceProviderclass

ouhare left a reply on Can You Explain This Code

You should check your app/Http/Kernel.php file and your app/Http/Middleware folder.

ouhare left a reply on Url Rewriting Not Working Outside Laravel For Mix

Did you try to add processCssUrls: false to your mix options?

ouhare left a reply on Many To Many Relationship

Maybe you can use an additionnal pivot column to specify the "quantity of relations" ?

module_id | component_id | quantity
      1              |             1               |        3
22 Sep
2 months ago

ouhare left a reply on Anybody Using Vuetify?

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

https://quasar-framework.org/

17 Sep
2 months ago

ouhare left a reply on Load Js Dependecy In My Bootstrap.js

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

07 Sep
3 months ago

ouhare left a reply on Replacing A Large Array

Did you try to do something like:

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

?

23 Aug
3 months ago

ouhare left a reply on Lazy Loading A Relationship Works, But Eager Loading Fails

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

12 Jul
5 months ago

ouhare left a reply on Access Eloquent Relationship In Vue.js

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

data () {
    return {
        items: []
    }
}
27 Jun
5 months ago

ouhare left a reply on Pass Data From Laravel To [email protected]

Can you post your 'Project_model' class ?

21 May
6 months ago

ouhare left a reply on Not Redirecting After Submit

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"
})
17 May
6 months ago

ouhare left a reply on Search The Database But Does Not Pass The Value

@foreach ($cliente as $id => $cli)
    <option value="{{ $id }}">{{ $cli }}</option>
@endforeach
14 May
7 months ago

ouhare left a reply on How To Hide Id From URL

I guess you can use php session.

ouhare left a reply on Disable Reactivity

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

ouhare left a reply on Invalid Argument Supplied For Foreach()

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

06 Apr
8 months ago

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

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

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']
03 Apr
8 months ago

ouhare left a reply on Vue Not Updating On First Element Array

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

04 Mar
9 months ago

ouhare left a reply on Sqlite 3 And HTML Checkbox Trouble

Can you post the result of:

dd($request->all());
14 Feb
10 months ago

ouhare left a reply on Laravel Passport Not Respecting Oauth Refresh_token?

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

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

29 Jan
10 months ago

ouhare left a reply on Laravel Echo To Window Object?

ok, thank you !

ouhare left a reply on Laravel Echo To Window Object?

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?

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'
});
26 Jan
10 months ago

ouhare left a reply on Vue.js Component Rendering After Prop Update

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>
21 Jan
10 months ago

ouhare left a reply on Get An Item From A Collection With Percent Rate

Thank you @burlresearch ! the first implementation is perfect!

ouhare left a reply on Get An Item From A Collection With Percent Rate

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

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]
];
20 Jan
10 months ago

ouhare started a new conversation Get An Item From A Collection With Percent Rate

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?

16 Jan
11 months ago

ouhare left a reply on Abort() Results In 500 Error

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

14 Jan
11 months ago

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

any errors in javascript or php ?

did you "console log" out all your data ?

ouhare left a reply on Websocket Help Needed

Loook at the socket.io website !

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

07 Jan
11 months ago

ouhare left a reply on Access Data Inside Mounted VueJS

@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

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

https://github.com/axios/axios

14 Dec
1 year ago

ouhare left a reply on How Do You Convert This To Eloquent

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

How your user can be affected to a job ?

05 Dec
1 year ago

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

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 !