moukbel

moukbel

Member Since 4 Months Ago

Experience Points 4,000
Experience Level 1

1,000 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.

21 Jul
1 day ago

moukbel 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)

            
            },

moukbel started a new conversation How To Make Menu Active In Slidebar Menu

hi,

i have to use this method to 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 ? thkanks

17 Jul
5 days ago

moukbel 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

16 Jul
6 days ago

moukbel left a reply on Asset() Work With Localhost , Not With Domain.local

Yes, inside icons directory there is a file icons.svg

moukbel left a reply on Asset() Work With Localhost , Not With Domain.local

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

moukbel left a reply on 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

moukbel left a reply on Asset() Work With Localhost , Not With Domain.local

thanks, still nothing work yet

moukbel left a reply on Asset() Work With Localhost , Not With Domain.local

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
15 Jul
1 week ago

moukbel left a reply on Asset() Work With Localhost , Not With Domain.local

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>

moukbel 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="">

but seem to work if i access it like this:

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

any idea ??

14 Jul
1 week ago

moukbel started a new conversation Changing Variables.scss Not Working !

hi, i start a new project and Im trying to change some variables not seem nothing is 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') }}">
13 Jul
1 week ago

moukbel left a reply on Many Virtual Host In Localhost/!! ?

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

moukbel left a reply on Many Virtual Host In Localhost/!! ?

i'm using window system

12 Jul
1 week ago

moukbel left a reply on Many Virtual Host In Localhost/!! ?

service worker only work with https or localhost

moukbel 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 like this:

project1.local
project2.dev
...

any help

15 Jun
1 month ago

moukbel left a reply on Check If $_SERVER['HTTP_REFERER'] Is Empty

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

moukbel 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'] ;  
        }
06 Jun
1 month ago

moukbel left a reply on 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

05 Jun
1 month ago

moukbel started a new conversation Can I Make This API More Secure ?

Hi, the User Fill the forms to buy Something than the request will send to API to 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

encode(){

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(
                $m_shop,
                $m_orderid,
                $m_amount,
                $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

01 Jun
1 month ago

moukbel left a reply on How I Can Write This In Better Way?

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

moukbel left a reply on How I Can Write This In Better Way?

@JOHNBRAUN - thanks, i'm getting this ErrorException

htmlspecialchars() expects parameter 1 to be string

moukbel 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>

moukbel left a reply on 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 ?

31 May
1 month ago

moukbel left a reply on 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()?

moukbel 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

moukbel left a reply on Load Multi Table Data

@JLRDW - thanks for helping

moukbel left a reply on Load Multi Database 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

moukbel started a new conversation Load Multi Database Data

hi, I'm doing a Multiple Users Logging In system, there are 3 databases 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

22 May
2 months ago

moukbel 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?

05 May
2 months ago

moukbel left a reply on How Can I Rename Column In Database? Can I Do That Manually?

just delete the old table from db then delete the releated row from the migration table , then you can remigrate

moukbel left a reply on Changing DB_PASSWORD

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

moukbel left a reply on Changing DB_PASSWORD

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

04 May
2 months ago

moukbel started a new conversation Help With Kreait\Firebase\Messaging\Notification;

hi, i'm trying to send / recive notification using firebase Kreait\Firebase\Messaging\Notification; anyone has idea how to do that ?

moukbel started a new conversation Changing DB_PASSWORD

hi, when I'm changing DB_PASSWORD via. env I'm getting access denied for this user i'm using these artisan command using route but still got the same problem

Route::get('/clear-cache', function() {
   
    $exitCode = Artisan::call('cache:clear');
    $exitCode = Artisan::call('config:clear');
    $exitCode = Artisan::call('config:cache');
 
});

what else should i update to allow access db using the new user

thanks

02 May
2 months ago

moukbel left a reply on Array OrderBy Work Only For First Letter!

@FTIERSCH - thanks it's work now ,but there is little problem , when i convert the value to integer i need to make the number with to decimal like this 0.00

when i use : parseInt() => it's return a integer without decimal, parseFloat( ).toFixed(2) => it's return a string with 2 decimal , not an integer Number() => it's return a integer with valued decimal like 00.1

any way to return Integer with decimal even the number have no value like 0.00?

moukbel started a new conversation Array OrderBy Work Only For First Letter!

hi, I'm trying to make a sorting table, everything works well except when the number gets higher than 9. the orderd will be somthing like this :

1
1
16
12
5
6
7
8
85
9

instead of 

1
1
5
6
7
8
9
12
16
85

computed: {
         
            orderedProducts: function () {
                const vm = this;
                return _.orderBy( vm.filterby , [vm.sortKey], ['asc'])
            },
}

moukbel left a reply on POST Not Found In Request

@MUNAZZIL - i did above , this is what i got:

POST /IPNWM HTTP/1.1 Accept: */* 
Accept-Language: ru-RU 
Content-Length: 516 
Content-Type: application/x-www-form-urlencoded 
Host: xxx.com 
User-Agent: Mozilla/4.0 (compatible; Win32; WinHttp.WinHttpRequest.5) 
X-Forwarded-Proto: https 
X-Https: on 

LMI_MODE=0
LMI_PAYMENT_AMOUNT=1
LMI_PAYMENT_NO=26
...

moukbel started a new conversation POST Not Found In Request

hi

in my controller, if I return the $request


namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\Schema;

class IPNController extends Controller
{
    public function ipn(Request $request){

    return $request;
}

}

i got all the request info


POST /IPNWM HTTP/1.1 Accept: */* 
Accept-Language: ru-RU 
Content-Length: 516 
Content-Type: application/x-www-form-urlencoded 
Host: xxx.com 
User-Agent: Mozilla/4.0 (compatible; Win32; WinHttp.WinHttpRequest.5) 
X-Forwarded-Proto: https 
X-Https: on 

LMI_MODE=0
LMI_PAYMENT_AMOUNT=1
LMI_PAYMENT_NO=26
...

but when i trying to access one of them

 if(!isset($_POST['LMI_MODE'])){
            die('not found');
            
        }

i'm alwase get not found a message

28 Apr
2 months ago

moukbel left a reply on Table Filter & Sorting !!

i found the solution using regular expression


 filterby: function () {
                const vm = this;
                return vm.categories.filter(function (product) {
                var searchRegex = new RegExp(vm.search, 'i');
    
                    return   (
                        searchRegex.test(product.id) ||
                        searchRegex.test(product.name) ||
                  
                    )
                })
       
            },

27 Apr
2 months ago

moukbel started a new conversation Table Filter & Sorting !!

hi, i want to build a table with sorting and box filter, i know how to do every one, but i don't know how to combine them

table building:

 <thead class="thead-dark">
                  <tr>
                      <th style="width:5%" @click="sortby('id')"> ID</th>
                      <th style="width:50%" @click="sortby('name')">Name</th>
                      <th style="width:5%" @click="sortby('price')">Price</th>

                  </tr>
                </thead>

                <tbody >
                    
                      <tr v-for="card in orderedProducts " :key="card.id">
...... etc

computed:

     orderedProducts: function () {
                return _.orderBy(this.categories, ['name'], ['asc'])
             }

methods:

  sortby(key){
                this.sortKey = key;
            },

20 Apr
3 months ago

moukbel started a new conversation How To Connect Pusher With Service Worker Push Notification

I'm trying to add PushNotificaion to my web app, can anyone tell me how to connect service worker to Receive Push Notification

also, don't know how to get applicationServerPublicKey; this is my code in app.vue


const app = new Vue({
    el: '#app',
    data: function () {
        return{
            page:'',
            applicationServerPublicKey:'BDlHTdC-EXuGjyiyQAjpxgtCNg4_nIoF_jB_CwFWfQoRht4W9MdznGYCUKz2JvsvsCAjBGPSb69rM2g4WmD7lpk',
            applicationServerKey:'',
            swRegisteration:null,
            isSubscribed:false,
        }
      },
      methods:{
        pagename(e){
          //console.log(e);
          const vm = this;
          vm.page=e;
        },


        urlBase64ToUint8Array(base64String) {
          var padding = '='.repeat((4 - base64String.length % 4) % 4);
          var base64 = (base64String + padding)
              .replace(/\-/g, '+')
              .replace(/_/g, '/');
      
          var rawData = window.atob(base64);
          var outputArray = new Uint8Array(rawData.length);
      
          for (var i = 0; i < rawData.length; ++i) {
              outputArray[i] = rawData.charCodeAt(i);
          }
          return outputArray;
          },

          initilizeUI(){
              const vm = this;

              if(vm.isSubscribed){
                  //unsubscribeUser();
                  console.log('unsubscribeUser');
              }else{
                  //subscribeUser();
                  console.log('subscribeUser');
              }
           
            
            vm.swRegisteration.pushManager.getSubscription()
            .then( sub => {
                vm.isSubscribed = !(sub === null);
                if(vm.isSubscribed){
                    
                    console.log('use is subcribed');
                }else{
                    console.log('user is not subcribed');
                    vm.subscribe();
                };
                
                vm.updateButton();
            })
          },

           updateButton(){
            if(Notification.permission == 'denied'){
                console.log("push messeging blocked");
                return;
            };
            
            if(vm.isSubscribed){
                 console.log("disable push messeging");
            }else{
              console.log("eneble push messeging");
            }

        },



        subscribe(){
          vm.swRegisteration.pushManager.subscribe({
              userVisibleOnly:true,
              applicationServerKey: vm.applicationServerKey
          })   
          .then(sub =>{
              console.log('user is subcribed');
              vm.isSubscribed=true;
              updateButton();
          })
          .catch(err=>{
            console.log('user  sub faild');  
          })
        },






    },

    mounted() {





      const vm = this;

      vm.urlBase64ToUint8Array= vm.urlBase64ToUint8Array(vm.applicationServerPublicKey);
      console.log(vm.urlBase64ToUint8Array);

      if('serviceWorker' in navigator && 'PushManager' in window){

        console.log('service worker && PUshManager Are Supperted')
       

            navigator.serviceWorker.register('service-worker.js')
           .then(reg =>{
               console.log('SW Registretion scope is:'+ reg)
                vm.swRegisteration =reg;
                vm.initilizeUI();
           })
            .catch(err => {
                console.error(err);
            })
 
    }else{
        console.log('SW not Supperted');
        //notyBTN.textContent="push notificion is not supported";
    }



16 Apr
3 months ago

moukbel started a new conversation How I Can Set Dynamic Value For My Variables

how i can set dynamic value for my variables

im getting this error:

Trying to get property 'price' of non-object

``


class Welcome extends Mailable
{
    use Queueable, SerializesModels;

    public $order;
    
    public $price;
    public $cuurency;


    public function __construct($order)
    {
        $this->order = $order;    ////work

        $this->price= $order->price;   /error
    $this->cuurency= $order->price;   /error
    }

 
    public function build()
    {
        
        
       return $this->view('maileclipse::templates.welcome');
    }
}

moukbel left a reply on How To Open/edit Blade Dynamically From Other Page

@YASSINEQORAICHE - how i can set dynamic value for my variables

class Welcome extends Mailable
{
    use Queueable, SerializesModels;

    public $order;
    
    public $price;
    public $cuurency;


    public function __construct($order)
    {
        $this->order = $order;    ////work

        $this->price= $order->price;   /error
    $this->cuurency= $order->price;   /error
    }

 
    public function build()
    {
        
        
       return $this->view('maileclipse::templates.welcome');
    }
}

moukbel left a reply on How To Open/edit Blade Dynamically From Other Page

@YASSINEQORAICHE - thanks yassin great tools , as you the creator of it , im getting this error in console but everything is working fine

tinymce.min.js:9 GET http://web.local/maileclipse/mailables/edit/template/css/content.css net::ERR_ABORTED 404 (Not Found)
15 Apr
3 months ago

moukbel started a new conversation How To Auth Maileclipse?

i wanna make allow access maileclipse for only admin ;

when i put : $this->middleware('auth'); inside the controller

class MailablesController extends Controller
{
    
    public function __construct()
        {
            $this->middleware('auth');
      abort_unless(
            App::environment(config('maileclipse.allowed_environments', ['local'])),
            403
      );
    }
....

the page keep redirect to the page in the :

RedirectIfAuthenticated.php

so i can't access the maileclipse page

moukbel left a reply on Sending Email When Submitting

@SNAPEY - @snapey what you mean !!,