ouhare

ouhare

Member Since 3 Years Ago

Perpignan, France

Experience Points 101,290
Experience Level 21

3,710 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 883
Lessons
Completed
Best Reply Awards 20
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.

25 Jun
3 weeks ago

ouhare left a reply on Vue: Rendering Images/components With V-for

@

<div class="LAYOUThub1_center_row_item_container" v-if="showImages">
  <div class="LAYOUThub1_center_item33_container" v-for="(item,index) in globals.bioItems" :key="index+'F'">
    <transition :name="transitionByIndex(index)" appear>
      <component v-if="item.component" :is="item.component"></component>
      <div v-else class="LAYOUThub1_center_item33_image" :style="'background-image:url('+item.image+');'"></div>
    </transition>
  </div>
</div>
20 Jun
3 weeks ago

ouhare left a reply on Vuelidate And @blur Not Working Correctly.

@barryjames yep, your promise have to be resolved or rejected !

......then(response => {
   if (response.data.email) {
      resolve(true)
   }
}.catch(error => {
   if (error.response.data.error.email[0] == 'The email has already been taken.') {
      resolve(false)
   } else {
      reject(error)
   }
}
19 Jun
4 weeks ago

ouhare left a reply on Vuelidate And @blur Not Working Correctly.

Hello !

Did you try to wrap your axios call in a Promise and return it ?

ouhare left a reply on How To Set Up Published_at Form In Laravel 5.8

Yes, you have to add published_at to your rules and to fill your post model.

Or you can manage this field in your function directly.

$dates = ['published_at'];

Inform laravel that it has to treat this column as a Carbon date.

03 Jun
1 month ago
19 Apr
2 months ago

ouhare left a reply on Why Does Public Broadcast Work Even Without Defining Channel?

@thebigk

channels.php is use for authorization (Private and Presence channels).

You are broadcasting using a Channel (which is public).

07 Apr
3 months ago

ouhare left a reply on Confused About User And Role With Eloquent

You should try

public function role()
{
        return $this->belongsTo('App\Role');
}

in your User model.

20 Mar
3 months ago

ouhare left a reply on JS Function In Laravel For Vue2?

@b

bind your function to the window object.

window.getMinMax= function (.....)
18 Mar
3 months ago

ouhare left a reply on Chat System - Laravel , Redis And Socket.io

@talhaatsix

If you use PresenceChannel, an event will be emit when the user close his browser or logout. Then, you can listen to it with Echo, and do your stuff.

https://laravel.com/docs/5.8/broadcasting#presence-channels

ouhare left a reply on Chat System - Laravel , Redis And Socket.io

@talhaatsix this flow is pretty okay.

to restrict messages sent to user, you have to use PresenceChannel (very useful for a chat system)

15 Mar
4 months ago

ouhare left a reply on Installing Vue Datatables Unable To Find Component

Did you run php artisan vendor:publish --tag=enso-assets ?

13 Mar
4 months ago
07 Mar
4 months ago

ouhare left a reply on Keep Current User Logged In When Creating A New User In Admin

@roerjo

My bad, I pick this trait in a old laravel project.

and yes, just follow the @roerjo solution, much cleaner.

ouhare left a reply on Keep Current User Logged In When Creating A New User In Admin

The RegisterController use a trait called RegistersUsers. In order to modify the auto login of the newly created user, you have to provide your own RegistersUserstrait.

Here the code of RegistersUsers trait :

<?php

namespace Illuminate\Foundation\Auth;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;

trait RegistersUsers
{
    use RedirectsUsers;

    public function getRegister()
    {
        return view('auth.register');
    }

    public function postRegister(Request $request)
    {
        $validator = $this->validator($request->all());

        if ($validator->fails()) {
            $this->throwValidationException(
                $request, $validator
            );
        }

        Auth::login($this->create($request->all()));

        return redirect($this->redirectPath());
    }
}

Just copy & paste it to your own trait file and don't forget to remove the line : Auth::login($this->create($request->all()));

Then use your trait in RegisterController !

05 Mar
4 months ago

ouhare left a reply on Laravel Not Executing Queries With 'DATEDIFF'

@bekaskaki

I think you don't need the $tgl variable. STR_TO_DATE needs a placeholder for the second parameter, not a formatted date.

Just run:

$data = DB::select('SELECT * ,IF(DATEDIFF(STR_TO_DATE(tgl_selesai, "%Y-%m-%d")), CURDATE())<=0,"Berakhir","Masih Berjalan") status FROM data_kerjasama');

ouhare left a reply on Laravel Not Executing Queries With 'DATEDIFF'

@bekaskaki try this

$data = DB::select("SELECT * ,IF(DATEDIFF(STR_TO_DATE(tgl_selesai, '$tgl')), CURDATE())<=0,'Berakhir','Masih Berjalan') status FROM data_kerjasama");

notice the simple quote to double quote

ouhare left a reply on Laravel 5.0.13 Not Passing Trough Update Function

@candyy ok, nice. So, you can mark this thread as solved.

04 Mar
4 months ago

ouhare left a reply on Laravel 5.0.13 Not Passing Trough Update Function

@candyy can you post the categories routes from routes/web.php ?

ouhare left a reply on Laravel 5.0.13 Not Passing Trough Update Function

@candyy Did you check Requests\UpdatePageRequest.php ?

it seems that you use the same Request class for a product and a category.

01 Mar
4 months ago

ouhare left a reply on Redirecting To A Show Controller Method After A Put Controller Method.

@lukio_3 so you have to to perform your redirection on the front-end.

ouhare left a reply on Redirecting To A Show Controller Method After A Put Controller Method.

Do you use an Ajax Request to update the record ?

29 Jan
5 months ago

ouhare left a reply on Still Unauthorized Using CreateFreshApiToken Middleware

@BILLRIESS - Sure !

routes/api.php

<?php

Route::get('user', function () {
  return auth()->user();
})->middleware('auth:api');

app\Http\Kernel.php

<?php

namespace App\Http;

use Illuminate\Foundation\Http\Kernel as HttpKernel;

class Kernel extends HttpKernel
{
    protected $middleware = [
        \App\Http\Middleware\CheckForMaintenanceMode::class,
        \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
        \App\Http\Middleware\TrimStrings::class,
        \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
        \App\Http\Middleware\TrustProxies::class,
    ];

    protected $middlewareGroups = [
        'web' => [
            \App\Http\Middleware\EncryptCookies::class,
            \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
            \Illuminate\Session\Middleware\StartSession::class,
            // \Illuminate\Session\Middleware\AuthenticateSession::class,
            \Illuminate\View\Middleware\ShareErrorsFromSession::class,
            \App\Http\Middleware\VerifyCsrfToken::class,
            \Illuminate\Routing\Middleware\SubstituteBindings::class,
            \Laravel\Passport\Http\Middleware\CreateFreshApiToken::class,
        ],

        'api' => [
            'throttle:60,1',
            'bindings',
        ],
    ];

    protected $routeMiddleware = [
        'auth' => \App\Http\Middleware\Authenticate::class,
        'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
        'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
        'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
        'can' => \Illuminate\Auth\Middleware\Authorize::class,
        'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
        'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
        'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
        'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
    ];

    protected $middlewarePriority = [
        \Illuminate\Session\Middleware\StartSession::class,
        \Illuminate\View\Middleware\ShareErrorsFromSession::class,
        \App\Http\Middleware\Authenticate::class,
        \Illuminate\Session\Middleware\AuthenticateSession::class,
        \Illuminate\Routing\Middleware\SubstituteBindings::class,
        \Illuminate\Auth\Middleware\Authorize::class,
    ];
}

ouhare left a reply on Still Unauthorized Using CreateFreshApiToken Middleware

@BILLRIESS - Yes it does and it returns 401 { "message": "Unauthorized" }.

It's working if I remove the middleware.

27 Jan
5 months ago

ouhare started a new conversation Still Unauthorized Using CreateFreshApiToken Middleware

Using Laravel 5.7 with Laravel Passport 7.0.5 and CreateFreshApiToken middleware and using vuejs & axios with default javascript scaffold (header X-CSRF-TOKEN and X-Requested-With).

My users are logged using session driver (Auth::attempt). I got the laravel_token attached on outgoing responses.

When I use axios to call '/api/user', the laravel_token cookie is correctly send (with laravel_session and XSRF-TOKEN) but I still have a 401 - Unauthorized response...

Do I do something wrong ?

03 Oct
9 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
9 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
9 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
9 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
10 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
10 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
10 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
1 year 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
1 year ago

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

Can you post your 'Project_model' class ?

21 May
1 year 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
1 year 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
1 year 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