moukbel

moukbel

Member Since 7 Months Ago

Experience Points
4,380
Total
Experience

620 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
16
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 1
4,380 XP
Oct
07
1 week ago
Activity icon

Started a new conversation Input Value Reset When Button Is Disabled

hi, how I can change and keep the new input Value then disable the button, because changing :disabled will rerender and return old inupt value

 props:['stocks','prices'],
        data(){
            return {
                isClicked:false,
            }
        },

<div  v-for="stock in stocks" v-bind:key="stock['id']" > 

 <input  type="number" placeholder="0" :value="oldPrice(stock['item_name'])">
                     
    <button @click="deleteStock(stock)" type="button" :disabled="isClicked">b</button>

</div>

set the value of the input from prices array

// check if the item has old price // if not set the price to 0.00
            oldPrice(name){
                const item = this.prices.filter( element => {
                    return element.product == name;
                })
                 if(item.length >0){
                   // return item[0]['price'];
                 }else{
                   // return 0;
                 }
                 return 353533;
                 
            },


now if i change the value of the input then clicked the button the value will return to the original one from prices array

  deleteStock(stock){
                this.isClicked=true;    
 
}

Aug
25
1 month ago
Activity icon

Replied to Update Data Inside V-for (without Getting An Infinite Update Loop)

yes, it's complected code to Collecting products prices and there quantity in the cart

Activity icon

Replied to Update Data Inside V-for (without Getting An Infinite Update Loop)

thanks,

Products is an array of array

Aug
24
1 month ago
Activity icon

Started a new conversation Update Data Inside V-for (without Getting An Infinite Update Loop)

Hi, i don't know how to update total without casing re-render.

template:

<div v-for="product in products" :key="product.id">
    {{  addToTotal(product.price)  }}
</div> 


data:

data(){
         return {
                total:0,
            }   
},

method:

addToTotal(e){
           
               this.total += e;
               return e;
            }
Aug
16
2 months ago
Activity icon

Replied to Upload/load Images In Shared Host?

@jlrdw

my public folder located here , including editing the path in index.php

/var/www/public_html/

and Laravel project is here :

/var/www/laravel/

i don't know why

            'root'   => public_path() . '/uploads',

refere to empty public folder inside here:

/var/www/laravel/public
Activity icon

Replied to Upload/load Images In Shared Host?

thanks for help,

I have added a new disk to filesystems.php

 'public_uploads' => [
            'driver' => 'local',
            'root'   => public_path() . '/uploads',
            'visibility' => 'public',
        ],

and use it to store file:


$path=  $request->file('file')->storeAs( 'products', $fileNameToStore , 'public_uploads' );

or

Storage::disk('public_uploads')->put( 'products' ,  $request->file('file') );

work fine locally but nothing appears in a shared host, instead, it's storeing in the old public folder, not inside project not inside public_html,

if i changed the root to this it's locating the folder currently :

 'root'   => public_path() . '/../../public_html/uploads',

Aug
15
2 months ago
Activity icon

Started a new conversation Upload/load Images In Shared Host?

hi, I knew its repeated question. create a symbolic link doesn't work in a shared host, so if I use this method to store file:

$path=  $request->file('file')->storeAs('products/',$fileNameToStore);

the files will stored in storage\app\public\products and i can't access it from public folder using: <img src="{{ asset(/storage/products/) }}''>

any help? thanks,

Jul
26
2 months ago
Activity icon

Replied to Using Orwhere() Without Effecting The Previews Conditions

thanks, TYKUS its work perfectly,

i had to add $key this way to work

 ->where(function ($builder) use($key) {

    }
Activity icon

Started a new conversation Using Orwhere() Without Effecting The Previews Conditions

hi,

i'm having table with 1000 records ;

1- im fetching by buyer_id then the results become 100;

2- then I'm using new where() to filter the results and it's now 10;

3- finally when i'm using group of orwhere() to do a search in these 10 results, i'm getting results between 0 - 1000 ! as if i didn't do the first two steps !


     $query = Records::where('buyer_id' , $request->id);
 // results is 1000

        if($request->status == 'true'){
            $query->where('status_text','debt');
        }  
// restuls is 100

    // search start here
 
             $query->where('created_at','LIKE','%'.$request->key.'%')
                    ->orwhere('item_name','LIKE','%'.$request->key.'%')
                    ->orwhere('txn_id','LIKE','%'.$request->key.'%')
 
             
 // results between 0 - 1000


        $query=$query->latest()->paginate(15);
 

any help how i could this search to start from the last results between 0 - 10

thanks,

Activity icon

Replied to Where('field', Condition)

@snapey

it's another issue

Activity icon

Replied to Where('field', Condition)

thanks,

but when this condition run

 $query->orWhere('field',$request->type);

it's cancel the previous one

where('txn' , otherCondition);

and fetch the data as if i did this:

$query = Records::Where('field',$request->type);

is there any way to keep the first condition and modify the results with other conditions using orwhere> i have to use orwhere because i'm doing somekind of search by key:

  ->orwhere('quantity','LIKE','%'.$key.'%')
  ->orwhere('currency','LIKE','%'.$key.'%')
 ->orwhere('order_total','LIKE','%'.$key.'%')

Jul
25
2 months ago
Activity icon

Started a new conversation Where('field', Condition)

hi, i have to fetch data where ( field , $request->type ),

but $request->type could be a null , and then i wanna fetch all records

public function getdata(Request $request){

    //   ether $request->type == null then i should fetsh all 
    //   or $request->type == somthing   which is normaly work 

         $fetchData= Records::where('field',$request->type)
                ->orwhere('txn' , otherCondition)
->paginate(5);

    }


Activity icon

Started a new conversation Logout After Session Expire?

hi, maybe it's repeated question,

if I logout after the session expire I got 419 | Page Expired so how to redirect to the login page either as auto redirect or when i post the logout after session expire ,?

thanks,

Jul
22
2 months ago
Activity icon

Replied to <textarea> Value Binding With Ckeditor

i don't think this is will work !

Jul
21
2 months ago
Activity icon

Started a new conversation <textarea> Value Binding With Ckeditor

hi, i have installed CKEditor but i could find way to get the value , the v-model not working !

i have trayed this but i need to click submit two times to get the updated text

<form  @submit.prevent="submit" method='POST' enctype="multipart/form-data">

<textarea id="article-ckeditor"  v-model="about" ref="about"  name="about" class="form-control" placeholder="about" required> </textarea>
<form>     

 methods:{
 
            
            submit(){

               console.log(this.$refs.about.value)

            
            },

Activity icon

Started a new conversation How To Make Menu Active In Slidebar Menu

hi,

i have to use this method in laravel to set current page as active in menu

<li class="nav-item">
                  <a href="/stocks" class="nav-link {{ request()->is('stocks') ? 'active' : '' }}">
                      <p>Stocks </p>
                  </a>
  </li>

Any idea how to do the same thing in Vue Component Menu, without using ?

thanks

Jul
17
3 months ago
Activity icon

Started a new conversation <RouterLink> Cannot Read Property 'resolve'

hi, I'm trying to use to set the correct menu as active when I click it, and I'm getting this error, anyone knows what it's mean?


Error in render: "TypeError: Cannot read property 'resolve' of undefined"

found in

---> <RouterLink>

app,js

import VueRouter from 'vue-router';
Vue.use(VueRouter);

slidebarMenu.js

<nav id="sidebar"  >
    <ul class="list-unstyled components" >
        <li >        
            <router-link to="/cpanel/orders">Orders</router-link>
        <li >
             <router-link to="/cpanel/products"></router-link>
        </li>
   </ul>
</nav>

thanks

Jul
16
3 months ago
Activity icon

Replied to Asset() Work With Localhost , Not With Domain.local

Yes, inside the icons directory there is also a file calledicons.svg

Activity icon

Replied to Asset() Work With Localhost , Not With Domain.local

@tray2

no, it was icons, if I rename the directory to icons and edit the asset link to src="{{ asset('/icons/1.png') }} i will still get the error

Activity icon

Replied to Asset() Work With Localhost , Not With Domain.local

i dont' know why but when i changed the name of the folder from icons to icon it workd

Activity icon

Replied to Asset() Work With Localhost , Not With Domain.local

@snapey

yeah it's give 404 , but it's work well and show the picture if i access the project like this

http://localhost/laravel/myproject/public/home
Jul
15
3 months ago
Activity icon

Replied to Asset() Work With Localhost , Not With Domain.local

@cronix

sure I have done that

<VirtualHost *:80>
    
    ServerName myproject.local
    ServerAlias myproject.local
    DocumentRoot "C:/wamp64/www/laravel/myproject/public"
    <Directory  "C:/wamp64/www/laravel/myproject/public">
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>

Activity icon

Replied to Asset() Work With Localhost , Not With Domain.local

APP_URL=http://localhost i have changed to

myproject.local

but still not working

Activity icon

Started a new conversation Asset() Work With Localhost , Not With Domain.local

hi, I add a virtual host to my project myproject.local

the asset() doesn't work

  <img src="{{ asset('/icons/1.png') }}" alt="">

``GET http://myproject.local/icons/1.png 404 (Not Found)``

but seem to work well if I access it like this:

http://localhost/laravel/myproject/public/home

any idea ??

Jul
14
3 months ago
Activity icon

Started a new conversation Changing Variables.scss Not Working !

hi, i start a new project and Im trying to change some variables, what seems is nothing working

$body-bg: red;

i have sure install node_mudules, npm run watch.

app.scss

// Fonts
@import url('https://fonts.googleapis.com/css?family=Nunito');

// Bootstrap
@import '~bootstrap/scss/bootstrap';

// Variables
@import 'variables';

webpack.mix

mix.js('resources/js/app.js', 'public/js')
    .sass('resources/sass/app.scss', 'public/css');

also i got error image not found when i try to load any image inside public/icons

 <img src="{{ asset('/icons/1.png') }}">
Jul
13
3 months ago
Activity icon

Replied to Many Virtual Host In Localhost/!! ?

haha sorry, when I reclick the best answer button it doesn't cancel the best answer

Activity icon

Replied to Many Virtual Host In Localhost/!! ?

i'm using window system

Jul
12
3 months ago
Activity icon

Replied to Many Virtual Host In Localhost/!! ?

service worker only work with https or localhost

Activity icon

Started a new conversation Many Virtual Host In Localhost/!! ?

hi, I wanna set up a all my virtual host on localhost in this way:

localhost/project 1 
localhost/project 2
locahost/...

and the reason for that, i have to test service worker in these project so could not use host name like this:

project1.local
project2.dev
...

any help

Jun
15
4 months ago
Activity icon

Replied to Check If $_SERVER['HTTP_REFERER'] Is Empty

@KISIARA - thanks, Kisiara, it's work in both way

Activity icon

Started a new conversation Check If $_SERVER['HTTP_REFERER'] Is Empty

hi, i wanna check from where pages are redirected to my page so i could add the link the back button

i'm using in my controller :

$_SERVER['HTTP_REFERER']

it's work fine but I got an error when someone tries to access my page directly

ErrorException
Undefined index: HTTP_REFERER

I have tried these methods but still nothing work :

   try{
            $location= $_SERVER['HTTP_REFERER'] ;
           
        }
        catch(Exception $exception){
            header('Location: http://www.google.com/');
            exit;
        };

if($_SERVER['HTTP_REFERER'] == null || $_SERVER['HTTP_REFERER'] == ""){
            header('Location: http://www.google.com/');
            exit;
        }else{
            $location= $_SERVER['HTTP_REFERER'] ;  
        }
Jun
06
4 months ago
Activity icon

Replied to Can I Make This API More Secure ?

@FTIERSCH - ok thanks, should i make the page as php and insert {!! csrf_field() !!} inside the form?

Activity icon

Replied to Can I Make This API More Secure ?

@FTIERSCH - cause i wanna hash the form data with a $secret key , than in the API.php i rehash the received input with same key and compare the two. but it's not correct cause anyone can send the data to '/encode' and received as hashed

Jun
05
4 months ago
Activity icon

Started a new conversation Can I Make This API More Secure ?

Hi,

1 - the User will Fill the forms to buy Something . 2 - encode the form data and send it to API. 3- API will check/release the product .

form:

<form method="POST" action="https://..API" @submit="encodeForm"  >  
<input type="hidden" name="QUANTITY" :value="q">
<input type="hidden" name="CURRENCY" :value="currency">  
<input type="hidden" name="EMAIL" :value="match">  

<input type="hidden" name="m_sign" :value="m_sign">  
...
..
<button type=submit> buy </submit>
</form>

Vue method

encodeForm(){

event.preventDefault(); 
axios.get('/encode', {
     params: {
        currency: usd,
        quantity:2,
    id:1
    ..
    .
     }
     .then(function (response) {
    this.m_sign= response.data;
    e.target.submit();  
}

}

encode.php

encode(Request $request){
$secret='123';
 $arHash = array(
                $id,
                $currency,
                $quantity,
                $m_curr,
                $m_desc
             );

    $m_key = md5($secret);

            $arHash[] = $m_key;
             
             $sign = strtoupper(hash('sha256', implode(':', $arHash)));

             return     $sign ;
}

API.php:

class API extends Controller
{
     
    public function API (Request $request){

    $secret='123';

     // Rejecting queries from IP addresses not belonging to orgingal website
       if (!in_array($_SERVER['REMOTE_ADDR'], array('123.123.12.1'))) return;


    // HMAC Signature check at this point using $secret key
    arHash = array(
        $_POST['1'],
        $_POST[2'],
    ...
    )
    $arHash[] = $secret;
    $sign_hash = strtoupper(hash('sha256', implode(':', $arHash)));
     if ($_POST['m_sign'] == $sign_hash)
        {

    }

    // Check the original price/currency to make sure the buyer didn't change it. 

    //release the product

}
}


shoud i use laravel passport for this

Jun
01
4 months ago
Activity icon

Replied to How I Can Write This In Better Way?

@TRAY2 - can I do many user guards using one user's table?

Activity icon

Replied to How I Can Write This In Better Way?

@JOHNBRAUN - thanks, i'm getting this ErrorException

htmlspecialchars() expects parameter 1 to be string
Activity icon

Started a new conversation How I Can Write This In Better Way?

public function index()
    {
        $allUsers=array();

        $admin = Admin::all();
        $reseller = Reseller::all();
        $accounting = Accounting::all();

        array_push($allUsers,$admin, $reseller, $accounting);
      
        //$post = Post::orderBy('id','desc')->paginate(5);
        return view('pages.users')->with('allUsers', $allUsers);
    }
<users getallusers='{{!! json_encode($allUsers) !!}}' > </users>

Activity icon

Replied to Displaying Message After Successful Registration

@SNAPEY - if i treat the users model as normal model , are they will stay work as a provider for the guard ?

May
31
4 months ago
Activity icon

Replied to Displaying Message After Successful Registration

@SNAPEY - thanks snapey,

 don't do this because you will be logged in as the new user and not the admin user.

yes i'm registering other users (admins, writers, users) , any more informaion about the registration flow ?

and where should i use User::create() or writers::create()?

Activity icon

Started a new conversation Displaying Message After Successful Registration

in RegisterController.phpI have used

protected function redirectTo()
    {
       
         return redirect('/users')->with('success','User has Added');   

    }

and I'm getting this message

ErrorException
Header may not contain more than a single header, new line detected

when i use return ' users/' it work fine

Activity icon

Replied to Load Multi Table Data

@JLRDW - thanks for helping

Activity icon

Replied to Load Multi Table Data

@JLRDW - not 3 databases, it's 3 tables, My mistake

Activity icon

Replied to Load Multi Table Data

@TRAY2 - i wanna build guard for every user type with different Features, So to my understanding i need to build model for every user

Activity icon

Started a new conversation Load Multi Table Data

hi, I'm doing a Multiple Users Logging In system, there are 3 table for users type ( Admins, Users, writers )

the admin should see all the registered users, so how i could load all user from the the 3 database , should i call them Separated or there is a way to connect them and make one call ?

thanks

May
22
4 months ago
Activity icon

Started a new conversation Build Page With Java-script Link

hi, I want to build a single webpage using js/HTML , and make people load this page in there website using a javascript link like this:

<script src="https://.www.web.com/webpage.js"></script>

any idea how I can do this?

May
05
5 months ago
Activity icon

Replied to How Can I Rename Column In Database? Can I Do That Manually?

1- delete the old table from db 2- then delete the releated row from the migration table 3 - remigrate

Activity icon

Replied to Changing DB_PASSWORD

@TRAY2 - thanks tray2, yes i have changed the password in the mysql first

Activity icon

Replied to Changing DB_PASSWORD

@PUNKSOLID - thanks punkolid , i'm doing this artisan as you see in the code