moukbel

moukbel

Member Since 3 Months Ago

Experience Points 3,300
Experience Level 1

1,700 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 13
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.

15 Jun
1 week 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
2 weeks 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
2 weeks 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
3 weeks 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
3 weeks 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
1 month 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
1 month 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
1 month 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
1 month 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
1 month 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
1 month 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
2 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
2 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
2 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 !!,

14 Apr
2 months ago

moukbel left a reply on Sending Email When Submitting

@SNAPEY - when the form is submitted it should go to different website, so how i can use results ? can you explain more, also i'm using axios to send the email from the controller , these are my steps : after @submit event - call function 1- event.preventDefault(); 2- collecting data from input forms 3- use axios to send data to controller them send the email from there 4-submit the form and redirect to another page

moukbel started a new conversation Sending Email When Submitting

i'm trying to send an email to a client when submitting the button, i 'm using this method but the mail is not sending every time :

<form method="get" action="...."  @submit="myFunction" >
.....
</form> 

<form method="get" action="...."  @submit="myFunction" >
.....
</form> 






/// Vue script 

methods:{

    
    myFunction(e) {
       const vm=  this;
     
      event.preventDefault();

    /////////////////////////////////// im sending the form data to api using axios and the api will send and email
       axios.get('https://....')
      .then(function (response) {
         console.log(response.data);
          
    
      })
    ///////////////////////////////// then here i'm submitting the form and the page redirect to new url
       e.target.submit(); 

...


if i but the e.target.submit(); inside the .then() the email will sending everytime but the user will wait for couple seconds before the form is submitted and redirect

the page is .html and i can use and php so i'm using axios and help?

12 Apr
2 months ago

moukbel started a new conversation How To Change The Email Blade Dynamically

hi, I wanna make a page which has ckeditor to change the email blade design.

can I open the email blade directly using ckeditor or I should store the input from ckeditor on the database then fetch it in email controller or what the better way?

11 Apr
2 months ago

moukbel started a new conversation No 'Access-Control-Allow-Origin'

hi, i'm getting this message when i request the API from other hosts :

Access to XMLHttpRequest at 'https://newSite.com/getItemDetails/1' from origin 'http://orginalsite.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

request via Axios:

axios.get('https://orginalsite.com/getItemDetails/1')

Route:

//Get Item Details 
Route::get('/getItemDetails/{id}','[email protected]');

Controller:


class GetItemDetailsController extends Controller
{
  
     
    public function getItemDetails($id)
    {
        //
        $getProductDetails = Lists::find($id);
       return $getProductDetails;
    }
 
}

Kernel.php

protected $middleware = [
        \Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
        \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
        \App\Http\Middleware\TrimStrings::class,
        \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
        \Barryvdh\Cors\HandleCors::class,   
    ];

cors.php:

 'supportsCredentials' => false,
    'allowedOrigins' => ['*'],
    'allowedOriginsPatterns' => [],
    'allowedHeaders' => ['*'],
    'allowedMethods' => ['*'],
    'exposedHeaders' => [],
    'maxAge' => 0,
07 Apr
2 months ago

moukbel left a reply on What The Best Way To Build Database Realtime Search

@FTIERSCH - thanks for replay , yes i mean just display the result as user write in search box

06 Apr
2 months ago

moukbel started a new conversation What The Best Way To Build Database Realtime Search

hello , what is the best way to build instant search using laravel and Vue

moukbel started a new conversation How To Send Notification To Android Using Firebase?

hi, I'm trying to send a notification from my Laravel web app to Android users using firebase,

i did a lot of searching but I didn't know exactly how to make it work,

any help?

03 Apr
2 months ago

moukbel started a new conversation How To Work With Service-workers With Laravel ?

any help in this subject?

moukbel started a new conversation Send Notification To Android ?

hi, what the steps for my Laravel web app to send A Notification to Android users, also is the notifications will keep working when the browser is closed?

moukbel started a new conversation Send On-Demand Notifications To Database?

hi , can you tell me how to send On-Demand Notifications to database?

i have tryed this :

Notification::route(database')
            ->notify(new InvoicePaid($invoice));
30 Mar
2 months ago

moukbel left a reply on Can I Send Email When Submit Button

thanks, but what I have: more then one form and submit button in one page and these forms are for sending payment information to a website like PayPal, bitcoin ..etc so when the user clicks one of the submit he will redirect to the bank website immediately.

and what I need: to send an invoice to the client when he Clicks the submit

how i can submit form and sending the email in same time

moukbel started a new conversation Can I Send Email When Submit Button

i have many form in one page and i wanna send email when use click one of the submit

<form 1>
    <input ....>
    <submit 
</form>

<form 2>
    <input ...>
    <submit>
</form>

29 Mar
2 months ago

moukbel left a reply on Mail::to Sometime Work And Sometime Not

@FTIERSCH - yes sure i have remove that part