moukbel

moukbel

Member Since 1 Month Ago

Experience Points 2,480
Experience Level 1

2,520 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 12
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.

20 Apr
2 days 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
6 days 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
1 week 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
1 week 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
1 week 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
1 week 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 weeks 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 weeks 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 weeks 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
3 weeks 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
3 weeks ago

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

@FTIERSCH - yes sure i have remove that part

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

@SCREENBEETLE - no error in my error log ,just the 500 status i'm using mailbox configuration in my shared host with Secure SSL Settings

my env for email :

MAIL_DRIVER=smtp
MAIL_HOST=mail.voilahost.com
MAIL_PORT=465
[email protected]
MAIL_PASSWORD=***
MAIL_ENCRYPTION=ssl

moukbel started a new conversation Mail::to Sometime Work And Sometime Not

when im sending email via API:

Mail::to('my email)->send(new ApiReport($msg));

it's work most the time , and sometime i just got

500 internet Server error

moukbel left a reply on Pass Id To Child Props Doesn't Work

@FTIERSCH - i had passed the props with : and the name and other fields works fine but the id doesn't update inside the child

moukbel started a new conversation Pass Id To Child Props Doesn't Work

i can pass many parameters to child except id , which still 0 parent:


data: function () {
      return{
     categories:"",
         categoriesid:0,
   
        
      }
    },
 mounted() {
 /// after axios load :
  this.categories=response.data['name'];//// the result is myname
  this.categoriesID=response.data['id']; ////// the result is 1 

}

<child  getid="categoriesID" getname="categories"></child>

child :

{{getname}} //////////// show myname succussfully 
{{getid}}      ///////////// dosn't show 1 and still 0 
28 Mar
3 weeks ago

moukbel started a new conversation Mail:: Doesn't Work

I'm getting this message with Post request :

Status: 500 Internal Server Error

Route:

Route::post('/IPNperfectmoney','[email protected]')

Controller:

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\Mail;
use App\Mail\ApiReport;

class IPNperfectmoneyController extends Controller
{
   public function ipn(Request $request){
        Mail::to('[email protected]')->send(new ApiReport("TEST"));
 
        die('IPN OK'); 
   
    }   
}

Mailable:


namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;

class ApiReport extends Mailable
{
    use Queueable, SerializesModels;

    public $reports;

    /**
     * Create a new message instance.
     *
     * @return void
     */
    public function __construct( $reports)
    {
        $this->reports = $reports;
    }

    /**
     * Build the message.
     *
     * @return $this
     */
    public function build()
    {
        return $this->markdown('Email.Reports');
    }
}

Blade:

{{$reports}}
24 Mar
4 weeks ago

moukbel started a new conversation Can't Pass An Array To Mail::to

i can send any type of data successfully but when i used array i got

500 Internal Server Error

my api:

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\Mail;
use App\Mail\ApiReport;


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

 $order=array(
                'name'=> $buyer_name,
                'item_name' => $item_name,
                'sn' => $get_sn,
                'amount' => $amount1,
                'currency' => $currency1,
                'order_total' => $order_total
            );


Mail::to('[email protected]')->send(new ApiReport($order));

    }
}

Mailable:

<?php

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;

class ApiReport extends Mailable
{
    use Queueable, SerializesModels;

    public $reports;

    public function __construct( $reports)
    {
        $this->reports = $reports;
    }


    public function build()
    {
        return $this->markdown('Email.Reports');
    }
}


blade:

{{$reports}}

any idea?

23 Mar
4 weeks ago

moukbel left a reply on Count Another Table Row

@TYKUS - every row in table 1 should count a number of records in table 2

table 1                         table2  
----------------   --->hasMany-->     ----------------     
count red: 2                          1- red
count blue:  3                                  2-red
                              3-blue
                              4-blue
                              5-blue

and whenever i add new records to table 2 , table 1 should recount

moukbel started a new conversation Connection Could Not Be Established With Host Smtp.gmail.com

whatever i do i got this error

(1/1) Swift_TransportException
Connection could not be established with host smtp.gmail.com [Permission denied #13]

env:

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=app-pass
MAIL_ENCRYPTION=tls

any idea ?

moukbel started a new conversation Count Another Table Row

I have two Table,

table 1 columns:   id - name - number
table 2 columns:   id - color - products

if I have 3 records ( 2 red, 1 blue ) in table 2 example table2:

1 - red - productName
2 - red - productName
3 - blue - productName

can I make table 1 (number) dynamically count the row number for every colour: example table 1:

1 - red - 2
2 - blue - 1
22 Mar
1 month ago

moukbel left a reply on Send Email Using Gmail

@ADAMPRICKETT - when i did i got this error:

stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages:
error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed

moukbel started a new conversation Send Email Using Gmail

i got this error:

Swift_TransportException
Expected response code 250 but got code "530", with message "530 5.7.0 Must issue a STARTTLS command first. w9sm2062655wmi.0 - gsmtp
"

dev :

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=myAccountPassword
MAIL_ENCRYPTION=null

controller:

public function sendEmail(){
    Mail::to("[email protected]")->send(new Invoice('somthing'));
}

mailable class:

<?php

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;

class Invoice extends Mailable
{
    use Queueable, SerializesModels;

    /**
     * Create a new message instance.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * Build the message.
     *
     * @return $this
     */
    public function build()
    {
        return $this->view('Email.Order');
    }
}

Route:

Route::get('/sendEmail','[email protected]');

mail.blade.php:

<h1>welcome</h1>
  • 2-Step Verification is on
  • it's work fine with mailtrap.io configuration

any idea ?

14 Mar
1 month ago

moukbel started a new conversation SQLSTATE[HY000] [2002] Permission Denied

when i upload my project to shared host i got this error :

View [auth.login] not found.

in FileViewFinder.php line 137
at FileViewFinder->findInPaths('auth.login', array('C:\wamp64\www\myproject\resources\views'))
in FileViewFinder.php line 79

and if i change the config.php name to config.php_ i can access the login page without any styles but then i got this when i submit

SQLSTATE[HY000] [2002] Permission denied 

if i add route this commend :

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

i got :

1/1) ErrorException
file_put_contents(C:\wamp64\www\laraver\JourCard\storage\framework\views/f6684ca233d16f33003578f26d5c9e459f189b95.php): failed to open stream: No such file or directory

any help?

moukbel left a reply on View [auth.login] Not Found ? On Shared Host

i got this when i add this route

file_put_contents(C:\wamp64\www\myproject\storage\framework/sessions/5IWcyFnZqob6Il0oiJLQLOKM5E43Yki8N4LpMmHy): failed to open stream: No such file or directory

in Filesystem.php line 122
at HandleExceptions->handleError(2, 'file_put_contents(C:\wamp64\www\myproject\storage\framework/sessions/5IWcyFnZqob6Il0oiJLQLOKM5E43Yki8N4LpMmHy): failed to open stream: No such file or directory', '/home/www/abdulkarimlube.com/admin/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php', 122, array('path' => 'C:\wamp64\www\laraver\JourCard\storage\framework/sessions/5IWcyFnZqob6Il0oiJLQLOKM5E43Yki8N4LpMmHy', 'contents' => 'a:3:{s:6:"_token";s:40:"Ig87XpCUMNtBc5lUuZvUKH8WTdnIH7OEoyDXdvej";s:9:"_previous";a:1:{s:3:"url";s:44:"http://abdulkarimlube.com/public/clear-cache";}s:6:"_flash";a:2:{s:3:"old";a:0:{}s:3:"new";a:0:{}}}', 'lock' => true))
at file_put_contents('C:\wamp64\www\myproject\storage\framework/sessions/5IWcyFnZqob6Il0oiJLQLOKM5E43Yki8N4LpMmHy', 'a:3:{s:6:"_token";s:40:"Ig87XpCUMNtBc5lUuZvUKH8WTdnIH7OEoyDXdvej";s:9:"_previous";a:1:{s:3:"url";s:44:"http://abdulkarimlube.com/public/clear-cache";}s:6:"_flash";a:2:{s:3:"old";a:0:{}s:3:"new";a:0:{}}}', 2)
in Filesystem.php line 122
at Filesystem->put('C:\wamp64\www\myproject\storage\framework/sessions/5IWcyFnZqob6Il0oiJLQLOKM5E43Yki8N4LpMmHy', 'a:3:{s:6:"_token";s:40:"Ig87XpCUMNtBc5lUuZvUKH8WTdnIH7OEoyDXdvej";s:9:"_previous";a:1:{s:3:"url";s:44:"http://abdulkarimlube.com/public/clear-cache";}s:6:"_flash";a:2:{s:3:"old";a:0:{}s:3:"new";a:0:{}}}', true)
in FileSessionHandler.php line 83
at FileSessionHandler->write('5IWcyFnZqob6Il0oiJLQLOKM5E43Yki8N4LpMmHy', 'a:3:{s:6:"_token";s:40:"Ig87XpCUMNtBc5lUuZvUKH8WTdnIH7OEoyDXdvej";s:9:"_previous";a:1:{s:3:"url";s:44:"http://abdulkarimlube.com/public/clear-cache";}s:6:"_flash";a:2:{s:3:"old";a:0:{}s:3:"new";a:0:{}}}')
in Store.php line 129
at Store->save()
in StartSession.php line 87
at StartSession->terminate(object(Request), object(Response))
in Kernel.php line 218
at Kernel->terminateMiddleware(object(Request), object(Response))
in Kernel.php line 189
at Kernel->terminate(object(Request), object(Response))
in index.php line 58

moukbel left a reply on View [auth.login] Not Found ? On Shared Host

@DOUGLASAKULA - i don't use SSH so how i clear the cache

also when i rename the configs.php the problem disappears and login screen show without any styles and after login i got this message

SQLSTATE[HY000] [2002] Permission denied 

moukbel started a new conversation View [auth.login] Not Found ?

i got this message after i uploaded my project file to shard host

InvalidArgumentException View [auth.login] not found.

in FileViewFinder.php line 137 at FileViewFinder->findInPaths('auth.login', array('C:\wamp64\www\myproject\resources\views')) in FileViewFinder.php line 79 at FileViewFinder->find('auth.login') in Factory.php line 130 at Factory->make('auth.login', array(), array()) in helpers.php line 1011 at view('auth.login') in AuthenticatesUsers.php line 20 ......

my rout file has : Auth::routes();

my view auth folder has the login.blade.php

any ideas?

10 Mar
1 month ago

moukbel started a new conversation Get Axios Data In Controller Return An Error

I got this error: 500 (Internal Server Error)

axios:

tname="name"; axios.get('/showtable/'+tname) .then(function (response ) { console.log( 'success' ); console.log(response ); }) .catch(function (error) { console.log(error); })

Route: Route::get("showtable/{tname}",'[email protected]');

controller: public function showtable(Request $request) {

    $data=$request->tname;
     if(Schema::hasTable($data)){
           $card_list = DB::table($data);
           return $card_list;
     };
   
    

}