moktar

moktar

Member Since 5 Months Ago

Experience Points 6,210
Experience Level 2

3,790 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 47
Lessons
Completed
Best Reply Awards 0
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.

25 Dec
1 month ago

moktar left a reply on Laravel 5.1 Class '\App\User' Not Found, FatalErrorException In EloquentUserProvider.php Line 126

@SERGIU17 - dammit it was because the auth.php :

before : 
            'model' => App\Models\User::class,
after : 
            'model' => Shop\Models\User::class,

Sorry @ser

moktar started a new conversation Laravel 5.1 Class '\App\User' Not Found, FatalErrorException In EloquentUserProvider.php Line 126

I moved my User Model from App\User to App\Models\Users

Whenever I try to Login/Register(When submit information) it gives me error

FatalErrorException in /var/www/html/sms/vendor/laravel/framework/src/Illuminate/Auth/EloquentUserProvider.php

line 126: Class '\App\User' not found
I also run composer dump-autoload command, but no luck. Also tried this


EloquentUserProvider.php path is sms/vendor/laravel/framework/src/Illuminate/Auth/EloquentUserProvider.php line 126

public function createModel()
{
    $class = '\'.ltrim($this->model, '\');

    return new $class; //line# 126
}

Here is my settings for Models directory

composer.json "autoload": { "psr-4": { "Shop\": "app/" }, "classmap": [ "database/seeds", "database/factories" ] },

Model Directory Structure App/Models/

Model User.php

namespace App\Models;

Auth.php tried both lines, given below.

'model' => App\Models\User::class,
'model' => App\Models\User,

AuthController.php

use App\Models\User;
23 Dec
1 month ago

moktar started a new conversation Help With Shop Problem !!!

Hello , guys I have problems in a shop I don't know if can make one table include the customer and the seller or make 2 tables one for the seller and another for customer , it a dump question I know but I really I dont know what I must do . Thank you

22 Dec
1 month ago

moktar started a new conversation Return Api() !!!!

hello folks , I had checking an open source arm built with laravel and I found this expression and I didn't understand how it works .

return api([
'saved' => true,
'id' => $result->id
]);

what return api this is the first time I see it ?

20 Dec
1 month ago

moktar left a reply on Laravel Query Builder

SELECT DISTINCT smp.social_media_portal_name, elu.url FROM bs.bs_gs_external_link_urls elu JOIN pw.pw_gs_external_link_portals elp ON ( elu.external_link_url_id = elp.external_link_url_id ) JOIN pw.pw_gs_external_link_smp els ON ( elu.external_link_url_id = els.external_link_url_id ) JOIN pw.pw_kt_social_media_relations smr ON ( smr.social_media_relation_id = els.social_media_relation_id ) JOIN pw.pw_kt_social_media_types smt ON ( smr.social_media_type_id = smt.social_media_type_id ) JOIN pw.pw_kt_social_media_portals smp ON ( smr.social_media_portal_id = smp.social_media_portal_id ) WHERE elp.country_code = '?' AND elp.portal_id = ? AND elp.language_code = '?' AND smt.social_media_type_name IN ('?') AND elu.active = 1 AND elp.active = 1 AND els.active = 1 AND smr.active = 1 AND smp.active = 1 AND smp.social_media_portal_name IN ('?')
19 Dec
1 month ago

moktar started a new conversation JWTAuthServiceProvider' Not Found !!!!

I had add jwt token to my api and the register && login working very well but the middleware give me an error :

{
    "message": "Class 'Tymon\JWTAuth\Providers\JWTAuthServiceProvider' not found",
    "exception": "Symfony\Component\Debug\Exception\FatalThrowableError",
    "file": ...

this is the kernel :

        'jwt.auth' => Tymon\JWTAuth\Middleware\Authenticate::class,
        'jwt.refresh' => Tymon\JWTAuth\Middleware\RefreshToken::class,


this is the config file :

        Tymon\JWTAuth\Providers\JWTAuthServiceProvider::class,


  'JWTAuth' => Tymon\JWTAuth\Facades\JWTAuth::class,
        'JWTFactory' => Tymon\JWTAuth\Facades\JWTFactory::class,

route file :

Route::group(['middleware'=>['jwt.auth']],function (){
    Route::post('auth/register','Api\Auth\[email protected]');
});
18 Dec
2 months ago

moktar started a new conversation Multiplatform App

Hello folks , My boss wanna from me to make an app this app will be Multiplatform It will be in laptops and big screens and iOS , android , it will be for a big lab and and some Devices will be offline ( will not connected to the internet) , So , what do you advice me guys .Multiplatform Application

15 Dec
2 months ago

moktar left a reply on Passport Fails To Create The Personal Access Token

@andrewmack you a life saver , thank you so much

23 Nov
2 months ago

moktar left a reply on @ In Url

@SNAPEY - hhhhhhh really do you believe me if I say It take a lot of time in google it but no result , dammit how dump am I . Thanks dude .

moktar started a new conversation @ In Url

This thing was puzzled me : https://website.com/@almokhtar-bekkour , how they did it and why adding @ before a username , can somebody tell me. Thank you all

19 Nov
2 months ago

moktar left a reply on Interview Question !!

#thank you

moktar started a new conversation Interview Question !!

the recruiter has asked me a question I can't find a solution yet , he say what the deference way to migrate the database if we have 500 migration file , he say it will take all the day to migrate to database we want different way and faster !!! this is first time I hear this question !!!

08 Nov
3 months ago

moktar started a new conversation Have You Guys Gotten Some Income Selling Your Goodies On Codecanyon?

Have you guys gotten some income selling your goodies on Codecanyon? If so, why don't you share your profiles and goodies here?

Also if you've gotten any tips or tricks for us that want to start selling goodies there, feel free to engage into the thread!

Disclaimer: no disrespect to anyone, just mentioning Codecanyon since most of the users here are developers so that's the most suitable marketplace for us.

05 Nov
3 months ago

moktar started a new conversation Argument #1 (No Value) Of ...

i'm trying to follow jeffery in course "l'ets build a forum" but after 3 videos i had stucking in this when i try to make test to thread have replies : that what i get :

1) Tests\Unit\ThreadTest::test_thread_may_have_replies
PHPUnit\Framework\Exception: Argument #1 (No Value) of PHPUnit\Framework\Assert::assertInstanceOf() must be a class or interface name

/Volumes/HHD/Sources_Code/MyCode/Laravel/Forum/tests/Unit/ThreadTest.php:19
/Users/tor/.composer/vendor/phpunit/phpunit/src/TextUI/Command.php:203
/Users/tor/.composer/vendor/phpunit/phpunit/src/TextUI/Command.php:159

ERRORS!
Tests: 5, Assertions: 5, Errors: 1.

the unit test :

    public function test_thread_may_have_replies(){

        $this->withoutExceptionHandling();
        $thread = factory(Thread::class)->create();

        $this->assertInstanceOf('Illuminate/Database/Eloquent/Collection',$thread->replies);

    }
30 Oct
3 months ago

moktar left a reply on Inquiries About How Booking Sites Collect Information ? Apis ?

that what i had find nothing free hhh , thank you @D9705996

moktar started a new conversation Inquiries About Booking Sites How To Collect Information

I hope everyone is in good health. I just want to ask you how the reservation sites work, so how do you collect information about hotels, how to book them, how to know the available room and the date of their availability? if that works with apis how i can do something similar with laravel ? and is that possible ? and how to get much apis from deferents websites and fetch data ? exemple : https://booking.com thank you

moktar left a reply on Trix Text Editor Doesn't Work Mobile Browser

hello , i have the same problem did you fins a solution ?

24 Oct
3 months ago

moktar started a new conversation Fractal Package

guys i'm really confused , i has watching the serie "Incremental APIs: Level 3: Transformations" and @matt_libera include a link in description to this "What's New in Laravel 5.5: API Resources" , so what i understand no more Transformers ????

18 Oct
4 months ago

moktar left a reply on Dom Dosen't Refresh, What Wrong ?

@wilburpowery even like dosen't work .

moktar left a reply on Dom Dosen't Refresh, What Wrong ?

@wilburpowery i had made like you say : but nothing change

<NewPost v-if="newpost" :user_id="this.user_id" @posted(handlePostedEvent)></NewPost>

methods:{
            handlePostedEvent(){
                this.posts.push(post)
            }
        }

moktar left a reply on User_id D'ont Sent With Vue Event Bus !!!

the solutions is : in post component bind the user_id prop in :

                    <NewPost v-if="newpost" :user_id="this.user_id"></NewPost>

moktar started a new conversation Dom Dosen't Refresh, Why ?

this error take 2 days from me hhh i don't know what i can do i had tried maybe all solutions with event bus but nothing yet . i'm trying to send an event when post has been add and push it to array of posts in parent component

// newpost.vue 

        methods :{
            addpost(){
                axios.post('posts',{
                    title : this.title,
                    category_id : this.category_id,
                    post_body : this.post_body,
                    user_id : this.user_id,
                }).then((response)=>{
                    EventBus.$emit('posted',response.data)
                }).catch((error)=>{
                    if(error.response.status == 422){
                        this.errors.push(error)
                    }
                })
            },
        }
// app.js
export const EventBus = new Vue();

parent component :

// posts.vue

<template>
    <div>
        <button class="btn btn-primary btn-sm mb-4" @click="newpost = true" v-if="!newpost">new post</button>
        <button class="btn btn-info btn-sm mb-4 text-white" @click="newpost = false" v-if="newpost">close</button>
        <div class="formnewpost  p-4">
            
            <div class="alert alert-danger" v-if="errors.length > 0">
                <p v-for="error in errors" :key="post">
                    {{error.response.data.errors['title'][0]}}<br>
                    {{error.response.data.errors['post_body'][0]}}<br>
                    {{error.response.data.errors['user_id'][0]}}
                </p>    
            </div>

                    <NewPost v-if="newpost" :user_id="this.user_id"></NewPost>

        </div>
        <div class="card">
            <div class="card-body" v-for="post in posts">
                <a :href="'/posts/'+post.slug">{{post.title}}</a>
            </div>
        </div>
    </div>

</template>
<script>
    
    import { EventBus } from '../app';

    export default {
        components : {
            'NewPost' : require('./NewPost.vue')
        },
        props : ['all_posts','user_id'],

        mounted (){
            EventBus.$on('posted',(post)=>{
                this.posts.push(post)
                console.log(post)
            })
        },

        data (){
            return{
                posts : JSON.parse(this.all_posts),
                errors : [],
                title : '',
                category_id : '',
                post_body : '',
                newpost : false
            }
        },  
     

    }
</script>

and the console give me that :

{…}
​
__ob__: Object { value: {…}, dep: {…}, vmCount: 0 }
​
>category_id: Getter & Setter
​
>created_at: Getter & Setter
​
>id: Getter & Setter
​
>post_body: Getter & Setter
​
>slug: Getter & Setter
​
>title: Getter & Setter
​
>updated_at: Getter & Setter
​
>user_id: Getter & Setter
​
><prototype>: Object { … }

​```

17 Oct
4 months ago

moktar left a reply on User_id D'ont Sent With Vue Event Bus !!!

@bobbybouwmann yes , i change it but user id still null , i think maybe error here . what you think

methods : {
           newpost(){
               this.$emit('new_post',user_id);
           }

        },

i

moktar started a new conversation User_id D'ont Sent With Vue Event Bus !!!

i have a parent and child component :

i has take user_id from here : author_id="{{\Auth::id()}}" and send it like props

 <vue-comment post_id="{{$post->slug}}" author_id="{{\Auth::id()}}"></vue-comment>
<script>
    
    export default {
        props : ['all_posts','author_id'],
        components : {
                "new-post" : require("./NewPost.vue")
        },
        data (){
            return{
                posts : JSON.parse(this.all_posts),
                newpostform : false,
                errors : [],
                user_id : this.author_id
            }
        },
        mounted (){
            this.$on('post_add',(post)=>{
                this.posts.push(post)

            })
        },
        methods : {
           newpost(){
               this.$emit('newpost',user_id);   ---------------> dosen't sent to child component ???
           }

        },

    }
</script>
<script>

    import axios from 'axios';

    export default{

         data(){
            return {
                newpostform : false,
                title : '',
                category_id : '',
                post_body : '',
                user_id : ''
            }
        },
        mounted (){
            this.$parent.$on('newpost', (user_id) =>{
                this.user_id = user_id                                ---------> this didn't receive the user is 
            })
        },

        methods :{
             addpost(){
                axios.post('posts',{
                    title : this.title,
                    category_id : this.category_id,
                    post_body : this.post_body,
                    user_id : this.user_id,              
                }).then((response)=>{
                    this.$parent.$emit('post_add',response.data)
                }).catch((error)=>{
                    if(error.response.status == 422){
                        this.errors.push(error)
                    }
                })
            },
        }
    }
</script>
15 Oct
4 months ago

moktar left a reply on Small Question

@click , that was so fast . thank you haha

moktar left a reply on Slug In Vue.js !!! Str_slug

@goatshark WTF hahaha it working and so easy to integrate thanks dude

moktar started a new conversation Small Question

Hello, can some one explain why this ":" after function name . and what it for i can't find a logique explanation .

 public function getSlugOptions() : SlugOptions

full code :

<?php

namespace App;

use Spatie\Sluggable\HasSlug;
use Spatie\Sluggable\SlugOptions;
use Illuminate\Database\Eloquent\Model;

class YourEloquentModel extends Model
{
    use HasSlug;
    
    /**
     * Get the options for generating the slug.
     */
    public function getSlugOptions() : SlugOptions
    {
        return SlugOptions::create()
            ->generateSlugsFrom('name')
            ->saveSlugsTo('slug');
    }
}

note : code from spate package sluggable

moktar left a reply on Slug In Vue.js !!! Str_slug

@goatshark aah ok thanks dude

moktar left a reply on Slug In Vue.js !!! Str_slug

@tykus  thank you for help but i didn't understand very well what you mean (newbie hh) so i will try the @goatshark solutions , thank you @goatshark 

moktar started a new conversation Slug In Vue.js !!! Str_slug

hello , does any one before try to generate a slug for post with vue and save to Data base ? i has looking for that for all day and nothing found , is there any way to add str_slug to vue.js code ?

addpost(){
                this.errors = [];
                axios.post('posts',{
                    title : this.title,
                    category_id : this.category_id,
                    post_body : this.post_body,
                    user_id : this.author_id,
                    slug : i dont know what i must do !! 
                }).then((response)=>{
                    console.log(response)
                }).catch((error)=>{
                    console.log(error)
                })
            },
            slug() {
                var title = this.title;
                var slug = title.replace(/\s+/g, '-');
                return slug;
            },

this is all code :

<template>
    <div>
        <button class="btn btn-primary btn-sm mb-4" @click="newpostform = true" v-if="!newpostform">new post</button>
        <button class="btn btn-info btn-sm mb-4 text-white" @click="newpostform = false" v-if="newpostform">close</button>
        <div class="formnewpost  p-4">
            <div  v-if="newpostform">
                <div class="form-group">
                    <input type="text" class="form-control" v-model="title">
                </div>

                <div class="form-group">
                    <input type="text" class="form-control" v-model="category_id">
                </div>
                <div class="form-group">
                    <textarea id="" cols="30" rows="10" class="form-control" v-model="post_body"></textarea>
                </div>

                <div class="form-group">
                <button class="btn btn-sm btn-success" @click="addpost()">post</button>
                </div>
            </div>
        </div>
        <div class="card">
            <div class="card-body" v-for="post in posts">
                <a :href="'/posts/'+post.slug">{{post.title}}</a>
            </div>
        </div>
    </div>

</template>
<script>
    import axios from 'axios'

    export default {
        props : ['all_posts','author_id'],
        data (){
            return{
                posts : JSON.parse(this.all_posts),
                newpostform : false,
                title : '',
                category_id : '',
                post_body : '',
                errors : [],
                slug: '',

            }
        },
        methods : {
            addpost(){
                this.errors = [];
                axios.post('posts',{
                    title : this.title,
                    category_id : this.category_id,
                    post_body : this.post_body,
                    user_id : this.author_id,
                    slug : i dont know what i must do !!
                }).then((response)=>{
                    console.log(response)
                }).catch((error)=>{
                    console.log(error)
                })
            },
            slug() {
                var title = this.title;
                var slug = title.replace(/\s+/g, '-');
                return slug;
            },
        },

    }
</script>

moktar left a reply on Form Dosen't Display With V-if !!!!

thanks @Yakagi , @s3nior , the problem was because calling vue.js 2 times from app.js and from cdn . https://media.giphy.com/media/1k2YhdutgkQzJWnsyp/giphy.gif

moktar left a reply on Form Dosen't Display With V-if !!!!

thanks @Yakagi , but is still not working

14 Oct
4 months ago

moktar started a new conversation Form Dosen't Display With V-if !!!!

i have this problem : when i click in button to show the hidden form noting displayed , i don't know what the problem .

<div class="container" id="app">
                <button class="btn btn-sm btn-dark" @click="openform()">reply</button>

                <br>
                <br>


                <div  v-if="openf">

                        <form action="">
                            <div class="form-group">
                                <input type="text" class="form-control">
                            </div>
                            <div class="form-group">
                            <textarea name="" id="" cols="30" rows="10" class="form-control"></textarea>
                            </div>
                        </form>
                </div>

</div>
@section('js_scripts')
    <script src="{{asset('js/vue.js')}}"></script>
    <script>
       var app =  new Vue({
           el : '#app',
           data : {
               openf : false,
           },
           methods : {
               openform : function(){
                   return this.open = true
               }
           }
        });
    </script>
@endsection
06 Oct
4 months ago

moktar left a reply on Is There Any Good Books For Designing Api (paid Or Free) ??

ok that looks awesome thank you

moktar started a new conversation Is There Any Good Books For Designing Api (paid Or Free) ??

i need a good books to how make an api from 0 to hero , (with laravel , paid , free?).

02 Oct
4 months ago

moktar left a reply on Data Lost After Redis Server Restart

ah thanks , look i had make like that save 1 1 now it working , is that good or will make a problems ?

moktar started a new conversation Data Lost After Redis Server Restart

guys when i restart my pc i lose all the the registred data in redis , but when i run '''BGSAVE''' via vue-cli before i restart it stay saved , what is the solution ?? did i must every time before i restart pc must run this command or what . what if i upload my webapp to server ???

08 Sep
5 months ago

moktar started a new conversation I Want To Delete The Stored Image While Update New Image

I want to delete the stored image while update new image , i has trying this method (unlink) but nothing change , is there any other way ?

  public function update(Serie $serie,Request $request)
    {

        if ($request->hasFile('image')){

            $oldimg = public_path("public/series/{str_slug($serie->image)}");
            if (\File::exists($oldimg)) {
              unlink($oldimg);
            }
            $image = $request->image;
            $name_img = str_slug($request->title).'.'.$image->getClientOriginalExtension();
            $image->storePubliclyAs('/public/series',$name_img);

        }
        else{
            $name_img = 'thumbnail';
        }
        $serie->title = $request->title;
        $serie->description = $request->description;
        $serie->image = '/series/'.$name_img;
        $serie->save();
        session()->flash('success','updated');
        return redirect()->route('serie.index');
    }