Devmaurice

Devmaurice

Lead Developer at Bidco Ltd

Nairobi

Hire Me

Member Since 3 Years Ago

Experience Points 90,300
Experience
Level
Lessons Completed 821
Lessons
Completed
Best Reply Awards 13
Best Answer
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.

08 Nov
1 month ago

Devmaurice started a new conversation Bind Modal Cancel To ESC Key.

Am used to using ESC key to cancel nowdays on most website....it would be nice to add it here...just a suggestion.

Devmaurice left a reply on What About New Look @laracast.com

Awesome .... Loves it

04 Oct
2 months ago

Devmaurice started a new conversation Broadcasting To Multiple Private Channels.

Is there a way i can broadcast to several private channels in the same event?

I tried this but didn't work. It only broadcasted to the last one.


 return [
                new PrivateChannel("orders"),
                new PrivateChannel("agent-orders-{$this->agent->id}")
            ];

Also tried this gave an error instead. Cant convertarray to String


 return  new PrivateChannel(["orders", "agent-orders-{$this->agent->id}"]);

Any help will be appreciated.

Thanks

05 Jul
5 months ago

Devmaurice left a reply on Data Storing

You can add events on the model itself then do whatever you want there.

//User::class

public static function boot()
{
    static::created(function($user)
    {
        //do what you want here
    });
}

Devmaurice started a new conversation Tailwindcss : Adding Custom Font Family From Google Font.

How do add font family to tailwindcss ?

 font-family: 'Lato', sans-serif; 
28 Jun
5 months ago

Devmaurice left a reply on How To Drop Table ?

You can do it manually by logging in to mysql.

19 May
6 months ago

Devmaurice started a new conversation Turn Off Camera Option On Html File Input On Mobile.

Guys how do turn off camera mode on html file input when uploading a file. I want to turn it off and only give the user the option to select file from the gallery.

17 May
6 months ago

Devmaurice left a reply on CDN Js Libraries In Mix Js

Use npm to download it then you can use it by importing.

https://www.npmjs.com/package/datatables

Devmaurice left a reply on Pushing Alerts To Multiple Sites Showing Doubles In Logs And Causing Other Issues

Check the server that is sending if it is invoking twice.

Devmaurice left a reply on Refactoring Account Settings Page Front/backend

  • First make a controller for the ** About ** and on the frontend you can make a vue component which makes it stand on its own though on the same page. The vue component will send data by ajax.

  • Since some of the validations can be null and you still want to validate when not null , there is a validation rule to facilitate that called ** nullable**.

  • From above point now you can move all validations to a validate Request file.

  • What i mostly do with file upload is move it to a Trait and from that function i can just get the url to save.(May be there is a better way.)

  • If validation passes then you can just assign values appropriately then check if the model is dirty and update it.

  • You can also use request('wins'); to get values instead of $request->get('wins');

    .....

      Auth::user()->club_id = $request->get('club');
    
      if(Auth::user()->isDirty()){
        Auth::user()->update();
      }
    
      flash('Great Job Profile Successfully Updated'); 
    

    return redirect()->back();

Devmaurice started a new conversation Laravel Passport Series

@JeffreyWay Could you do a lesson on Laravel Passport in api development. Mostly what i want to Know is :

  • Creating separate apps with app key and secret key. (like pusher does it )
  • Various way for app authentications with passport(Bearer $token , Authorization $token, .......

The basic idea is " someone come to my site , create an app , generate app key and secret key, Use passport to authenticate this app,and from there can use the service am providing.

If any one else has an idea/link/tutorial which may not need a lesson to do this i will appreciate to.

18 Apr
7 months ago

Devmaurice left a reply on Convert Laravel Project To Node Js

You will have to do the nodejs app from ground up but follow your business rules to achieve same purpose. I think that what @Sergiu17 meant.

17 Apr
7 months ago

Devmaurice left a reply on Twitter Dms With Laravel??

@wilk_randall been there ......cant figure it out

Devmaurice started a new conversation Twitter Dms With Laravel??

Is there a way i can get twitter Dms on laravel without using get, say using stream or push through a webhook??

13 Apr
8 months ago

Devmaurice left a reply on Internal Server Error On On Another Server

check folder permmisions on nginx conf.

check permissions on folders : bootstrap,storage and make sure the ownwership of folders is correct.

Devmaurice left a reply on Auth

@migdalius

You can create policy for that, then use on blade when displaying.

All you have to check is if the current logged user is the one who owns the email.

Devmaurice left a reply on Why Do Not Work Registration System In My Laravel 5.2 Blog.

@Flex

{!! Form::open() !!} 

change to

  {!! Form::open(['url' => 'auth/register']) !!}

so the form can know where to post.

Devmaurice left a reply on Forge And Amazon EC2

@pelachile You can just generate ssh key from your personal machine and add the public key on the server through forge. then you can ssh:

 ssh [email protected]

Follow this to generate ssh key.

12 Apr
8 months ago

Devmaurice left a reply on I Want With Out Login No One Cannot View Selected Page. What The Procedure For This Thing In Laravel ?

wrap your routes within ** auth** middleware.

Route::group(['middleware' => 'auth'], function(){
    //All routes here to be accessed you have to be logged in.
 });
11 Apr
8 months ago

Devmaurice started a new conversation Laravel Passport Third Party App Api.

I need help with my application which am using with passport for authentication. the app serves a mobile app and user's login with a username and a password. This part is done.

The part i need help is , am doing another app and i need to authenticate it to the previous app using SECRET KEY and CLIENTID . From this i will get may be a token which i will use to authenticate any other request. So how do i achieve this.....

29 Mar
8 months ago

Devmaurice left a reply on Sweet Alert And Toast For Laravel

very nice package. good work

Devmaurice left a reply on A Video File Server Configurations:

@rin4ik i had already done that. i found the problem i added this to my nginx file

   client_max_body_size 100M;
28 Mar
8 months ago

Devmaurice started a new conversation A Video File Server Configurations:

So suppose i want to do a vido uploader app. Which settings should change especially in php and nginx.

I get errors such as this

 413 Request Entity Too Large

but i have already bumped up my php.ini file upload size.

Its good to mention am using forge by @TaylorOtwell and i have changed the php-fpm config from there and restarted php-fpm.

22 Mar
8 months ago

Devmaurice started a new conversation Unknown Custom Element: <event-image> - Did You Register The Component Correctly? For Recursive Components, Make Sure To Provide The "name" Option

The following code is working on development but not on production , am getting error

  Unknown custom element: <event-image> - did you register the component correctly? 
  For recursive components, make sure to provide the "name" option

my .vue component looks like this:

<template>
    <div class="text-grey-darker text-center bg-grey-light mx-2 my-2 border border-teal 
 w-64 h-64 z-0 relative">                   
        <img :src="url" class="w-full h-full">
        <div class="pin-r pin-t absolute z-40">
            <button class="bg-transparent text-red bold text-xl italic" 
 @click="remove">X</button>
        </div>
                    
    </div>      
 </template>

 <script>

export default{
    name:'event-image',

    props: ['image'],

    data(){

        return {
            showspinner:false
        }
    },

    methods: {
        remove(){
            this.showspinner = true;
            axios.delete('/media/'+JSON.parse(this.image).id)
                  .then(response => {
                    this.showspinner = false;
                    location.reload();
                  })
                  .catch(errors =>{

                  });
        }

    },

    computed : {
        url(){
            return JSON.parse(this.image).url;
        }
    }
   }

  </script>

and registered it on app.js as:

 Vue.component(
'event-image',
require('./components/event/EventImage.vue'));

then used it on blade like:

  @foreach($images as $image)
                 <event-image image="{{ json_encode($image) }}" ></event-image>   
 @endforeach 

where is the error above comming from.

21 Mar
8 months ago

Devmaurice left a reply on Model Relation With Multiple Keys

Add an order_item_id on the OrderPromotion table .

20 Mar
8 months ago

Devmaurice left a reply on Fetch Auth::user()->name From Database

You are displaying data in javascript so blade part will not be translated/compiled by blade templating engine. You must use it directly in a blade file.

Devmaurice left a reply on Saving Pictures And Files

For saving attachments use a hash its the best.

Save it on s3 usually the best for me.

save the url to file in a database.

You can have a field to mark the active version .

Devmaurice left a reply on Store Data Until The Submit Button Is Pressed As Temporary

Your question is not clear. But am guessing you want want to manipulate the data before you submit. If that is the case you can use javascript, vuejs can help.

19 Mar
8 months ago

Devmaurice left a reply on Subscribe Laravel Events On Android/Api

Subscription to private channel

  PrivateChannel channel = pusher.subscribePrivate

Devmaurice left a reply on Subscribe Laravel Events On Android/Api

For any one who might be experiencing same problem in future i changd to this:

 HttpAuthorizer authorizer = new 
HttpAuthorizer("http://serverip/broadcasting/auth");
PusherOptions options = new PusherOptions().setAuthorizer(authorizer);

Pusher pusher = new Pusher(1234567891011, options);

 PrivateChannel channel = pusher.subscribePrivate("private-channel",
new PrivateChannelEventListener() {
    @Override
    public void onAuthenticationFailure(String message, Exception e) {

     System.out.println(
        String.format("Authentication failure due to [%s], exception was [%s]", message,  e)
        );
    }

    @Override
    public void onEvent(String channelName, String eventName, String data) {
    // Called for incoming events names "App\Events\CustomerOrderNewItem", "bar" or 
  "baz"
    }

    // Other ChannelEventListener methods
}, "App\Events\CustomerOrderNewItem","bar","baz");

You can refer to the documentation on github

17 Mar
8 months ago

Devmaurice started a new conversation Subscribe Laravel Events On Android/Api

Does anyone has an idea how i can achieve this.

I have done broadcast authentication already;

     Broadcast::routes(['middleware' => 'auth:api']);

and in the channel i have: Broadcast::channel('Shops-{id}', function ($user, $id) { return true; });

so how should my android Events looks like:

HttpAuthorizer authorizer = new 
    HttpAuthorizer("http://serverip/broadcasting/auth");
    PusherOptions options = new PusherOptions().setAuthorizer(authorizer);
   Pusher pusher = new Pusher(1234567891011, options);

  Channel channel = pusher.subscribe("Shops-52");

 channel.bind("App\Events\CustomerOrderNewItem", new SubscriptionEventListener() {
 @Override
 public void onEvent(String channelName, String eventName, final String data) {
    System.out.println(data);
   }
});

pusher.connect();

The above is not working though i can see that i have subscribed on the channel in the pusher's debug console.

The events seems not to be reaching the phone.

12 Mar
9 months ago

Devmaurice left a reply on Logged In User Info In Vue.js And Laravel

The /oauth/token url returns the token which you can use to query another url to get the current loggeIn user.

27 Feb
9 months ago

Devmaurice started a new conversation Pusher Public Channel Are Private On Production.

when am testing public channels on localhost they are okay but when i put it in production the public channels on pusher appear as private. Kindly help.

return new Channel('Shops-'.$this->shop->id);

Also i cant figure out why the broadcastwith data is not working.

Devmaurice started a new conversation Laravel Broadcast Events Appear Private Instead Of Public.

Am doing laravel events broadcast with pusher. When i broadcast as public they appear private on pusher.

public function broadcastOn()
{
    return ["Shop-{$this->shop->id}"];
}

Also tried

public function broadcastOn()
   {
    return Channel("Shop-{$this->shop->id}");
  }
15 Feb
9 months ago

Devmaurice left a reply on How Can We Use Our Own Database Fields For Auth Login In Laravel?

you can validate aganist your fields as you may wish. Just use :

 Auth::attempt([fields to auth aganist])

Example:

$credentials = array(
        'username' => request('email'),
        'password' => request('password')
    );

    if(Auth::attempt($credentials))
    {
        return "User has been logged in.";
    }
    else
    {
        //return Redirect::back()->with_input();
        return "User has not been logged in.";
    }    

Devmaurice started a new conversation Pusher Events.

Am dispatching events and i want to broadcast them to pusher as public.

  public function broadcastOn()
 {
    return ["Trips-{$this->trip->id}"];
 }

The event is appearing as private on pusher.

Same thing happens when i do :

 public function broadcastOn()
 {
    return Channel("Trips-{$this->trip->id}");
 }

Help.......

Devmaurice started a new conversation Laravel Events Subscribed By Android.

Am trying to subscribe laravel events with android but i cant get the hang of it. I can see it is subscribing but the event is not showing up on android. So should it be like

`` channel.bind("MyEvent", new SubscriptionEventListener() { @Override public void onEvent(String channelName, String eventName, final String data) { Log.e("data::", data);

        }
    });

``

or

`` channel.bind("App\Events\MyEvent", new SubscriptionEventListener() { @Override public void onEvent(String channelName, String eventName, final String data) { Log.e("data::", data);

        }
    });

``

I have triend all but none seem to be working.

10 Jan
11 months ago

Devmaurice started a new conversation Subscribe Pusher With Php(Laravel)

Is it possible to subscribe pusher channels using php using a command like Redis.

22 Nov
1 year ago

Devmaurice left a reply on Cart Session In A Stateless Environment

Well thanks i hope i will find one for redis or file ......

Devmaurice left a reply on Cart Session In A Stateless Environment

@martinbean I had implemented this cart (https://github.com/darryldecode/laravelshoppingcart)[this]

Now the problem is the cart works with sessions but do database or file driver. Is there a way or cart i can use this using file or database to serve stateless environment.

Devmaurice started a new conversation Cart Session In A Stateless Environment

So i have this app , an api serving mobile backed. I have implemented authentication and all that. Now i want to work on a cart. On my localhost using Postman,it's working very well.

The problem is when tunnel through ngrok for the mobile guys to test. The cart does not persist.

Am aware of the stateless situation i just don't know how i should go about this to create a cart to serve the mobile app.

Should the mobile app maintain the cart?

If it's laravel just a tip how i should go about it?

23 Jan
1 year ago

Devmaurice left a reply on Session Persist With Redis

@MarkLL Actually i was trying to do

session()->get('key');

and thats how i realize it was not persisting session so it's not that one

Devmaurice left a reply on Session Persist With Redis

@rickbolton

   Route::get('/', '[email protected]');
    Route::get('/login', '[email protected]');
    Route::post('/user/login', '[email protected]');

just that

Devmaurice left a reply on Session Persist With Redis

@rickbolton yea just after i set it is there but as soon as i redirect all is lost only token is left.

19 Jan
1 year ago

Devmaurice started a new conversation Session Persist With Redis

I want to use Redis for my session. I have set up everything and i can die dump the session and see the STORE object when i die and dump. The problem is when i add something on the session i cant see it in the session.

session()->put('user', 'My name');

Now when i refresh and i **dd($request->session()) ** i only see the _token parameter only.

Store {#183 ▼
  #id: "xymEy5TRfwZsmMeWzjkPDBOaYhCs4RqFouI6HRYy"
  #name: "laravel_session"
  #attributes: array:1 [▼
    "_token" => "eoWnt485RzOPypPBQMjqOuw5VzptT0k3Mz7Cc8LK"
  ]
......

Am using Centos 7 as my server.

NB: The session was acting the same even with the file as the driver.

 The redis driver is okay because i have been able to **set** and **get** from the Redis facade.
22 Jun
2 years ago

Devmaurice started a new conversation Executing Mssql Encrypted Stored Procedures

Am trying to execute a mssql procedure in laravel 5.2 but i cant get the gist. The procedure is encrypted.Also the procedure execute depending on some parameters not all.

what i have now.

 $db =DB::connection();
        $type = 'D';
        $email='[email protected]';
        $from = '15 June 2016';
        $to = '15 June 2016';

        $stmt = $db->getPdo()->prepare("EXEC ENCRYTEDPROC @type=?,@mail=?,@datefrom=?,@dateto=?"); 
        ///$stmt = $db->getPdo()->prepare("EXEC ENCRYTEDPROC ?,?,?,?"); 
        $stmt->bindParam(1, $type);
        $stmt->bindParam(2, $email);
        $stmt->bindParam(3, $from);
        $stmt->bindParam(4, $to);

        $stmt->execute();
        dd($stmt);
        do{
            $search= $stmt->fetchAll(PDO::FETCH_CLASS,'stdClass');

        }while( $stmt->nextRowset());

        dd($search);
17 Jun
2 years ago

Devmaurice started a new conversation LAravel Mssql Call Procedures.

How do i call a procedure in mssql in laravel 5.2. what i have tried.

http://stackoverflow.com/questions/20666490/laravel-4-mssql-stored-procedure-with-parameters-as-a-prepared-statements

Am getting an empty array but when i ran in sql server with the same parameters i get data.

03 Jun
2 years ago

Devmaurice left a reply on Password Reset On Mssql

@bobbybouwmann

Am getting this error

SQLSTATE[HY000]: General error: 273 General SQL Server error: Check messages from the SQL Server [273] (severity 16) [(null)] (SQL: insert into [dbo].[password_resets] ([email], [token], [created_at]) values ([email protected], 36edc15ad04c5e632c31a77194af0370ac5d2162065929137f8c28a54d8001b1, 2016-06-03 07:50:04.000))