Devmaurice

Lead Developer at Bidco Ltd

Experience

82,690

13 Best Reply Awards

  • Member Since 2 Years Ago
  • 750 Lessons Completed
  • 0 Favorites

5th July, 2018

Devmaurice left a reply on Data Storing • 2 weeks ago

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. • 2 weeks ago

How do add font family to tailwindcss ?

 font-family: 'Lato', sans-serif; 

28th June, 2018

Devmaurice left a reply on How To Drop Table ? • 3 weeks ago

You can do it manually by logging in to mysql.

19th May, 2018

Devmaurice started a new conversation Turn Off Camera Option On Html File Input On Mobile. • 2 months ago

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.

17th May, 2018

Devmaurice left a reply on CDN Js Libraries In Mix Js • 2 months ago

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 • 2 months ago

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

Devmaurice left a reply on Refactoring Account Settings Page Front/backend • 2 months ago

  • 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 • 2 months ago

@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.

18th April, 2018

Devmaurice left a reply on Convert Laravel Project To Node Js • 3 months ago

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.

17th April, 2018

Devmaurice left a reply on Twitter Dms With Laravel?? • 3 months ago

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

Devmaurice started a new conversation Twitter Dms With Laravel?? • 3 months ago

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

13th April, 2018

Devmaurice left a reply on Internal Server Error On On Another Server • 3 months ago

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 • 3 months ago

@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. • 3 months ago

@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 • 3 months ago

@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.

12th April, 2018

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

wrap your routes within ** auth** middleware.

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

11th April, 2018

Devmaurice started a new conversation Laravel Passport Third Party App Api. • 3 months ago

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

29th March, 2018

Devmaurice left a reply on Sweet Alert And Toast For Laravel • 3 months ago

very nice package. good work

Devmaurice left a reply on A Video File Server Configurations: • 3 months ago

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

   client_max_body_size 100M;

28th March, 2018

Devmaurice started a new conversation A Video File Server Configurations: • 3 months ago

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.

22nd March, 2018

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 • 4 months ago

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.

21st March, 2018

Devmaurice left a reply on Model Relation With Multiple Keys • 4 months ago

Add an order_item_id on the OrderPromotion table .

20th March, 2018

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

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 • 4 months ago

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 • 4 months ago

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.

19th March, 2018

Devmaurice left a reply on Subscribe Laravel Events On Android/Api • 4 months ago

Subscription to private channel

  PrivateChannel channel = pusher.subscribePrivate

Devmaurice left a reply on Subscribe Laravel Events On Android/Api • 4 months ago

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

17th March, 2018

Devmaurice started a new conversation Subscribe Laravel Events On Android/Api • 4 months ago

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.

12th March, 2018

Devmaurice left a reply on Logged In User Info In Vue.js And Laravel • 4 months ago

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

27th February, 2018

Devmaurice started a new conversation Pusher Public Channel Are Private On Production. • 4 months ago

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. • 4 months ago

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}");
  }

15th February, 2018

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

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. • 5 months ago

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. • 5 months ago

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.

10th January, 2018

Devmaurice started a new conversation Subscribe Pusher With Php(Laravel) • 6 months ago

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

22nd November, 2017

Devmaurice left a reply on Cart Session In A Stateless Environment • 8 months ago

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

Devmaurice left a reply on Cart Session In A Stateless Environment • 8 months ago

@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 • 8 months ago

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?

23rd January, 2017

Devmaurice left a reply on Session Persist With Redis • 1 year ago

@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 • 1 year ago

@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 • 1 year ago

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

Devmaurice left a reply on Session Persist With Redis • 1 year ago

@rickbolton It returns null

19th January, 2017

Devmaurice started a new conversation Session Persist With Redis • 1 year ago

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.

22nd June, 2016

Devmaurice started a new conversation Executing Mssql Encrypted Stored Procedures • 2 years ago

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

17th June, 2016

Devmaurice started a new conversation LAravel Mssql Call Procedures. • 2 years ago

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.

3rd June, 2016

Devmaurice left a reply on Password Reset On Mssql • 2 years ago

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

Devmaurice started a new conversation Password Reset On Mssql • 2 years ago

Where can I set the table used to reset the password. I have the table in mssql db for reseting the password password_resets but the app seem not to find it. Please help where I can point it like in eloquent model where we specify

protected $table = 'password_resets';

29th May, 2016

Devmaurice left a reply on Laravel Login. • 2 years ago

@SaeedPrez

what worked for me for now

public function login(Request $request)
    {
        $email = $request->input('email');

        $user = User::where('EmailID', '=', $email)->first();

        $Password = $request->input('password');

        if (Hash::check($Password, $user->PUK)) {
            Auth::loginUsingId($user->CorporateID);
        }
        return redirect('/home');
    }

28th May, 2016

Devmaurice left a reply on Laravel Login. • 2 years ago

@SaeedPrez @Snapey Is there a way i can do it manually like Auth::attempt('EMailID' => $email, 'PUK' => $password);. I cant change the columns names for now.

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.