Saturday 23 December 2017

Update Function Modal Box

I encountered the same problem, here is how i solved it. My modal is on the index.blade page, as follows:
<a data-toggle="modal" role="button" href="{{ URL::to('user/'.$user->id.'/edit') }}" class="btn btn-default"><i class="icon-pencil"></i></a>
Then the modal:
@if(!empty($user))
    <!-- Form modal -->
            <div id="edit_modal" class="modal fade" tabindex="-1" role="dialog">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                            <h4 class="modal-title"><i class="icon-paragraph-justify2"></i> Edit User</h4>
                        </div>

                        <!-- Form inside modal -->
                        {!! Form::model($user,array('route' => ['user.update', $user->id],'method'=>'PATCH')) !!}

                            <div class="modal-body with-padding">                               
                                <div class="form-group">
                                    <div class="row">
                                    <div class="col-sm-12">
                                        <label>First name</label>
                                        <input type="text" class="form-control" placeholder="Chinedu"
                                         name="name" value="{!! $user->name !!}">
                                    </div>
                                    </div>
                                </div>
                        {!! Form::close() !!}
@endif

@if(!empty($user))
<script>
$(function() {
    $('#edit_modal').modal('show');
});
</script>
@endif
My controller methods are:
public function index()
    {
        //View all users
        $users= User::orderBy('name', 'ASC')->paginate(10);
        return view('user.index',compact('users'));
    }

public function edit($id)
    {
        //
        $users= User::orderBy('name', 'ASC')->paginate(10);
        $user= User::findOrFail($id);
        return view('user.index',compact('users','user'));
    }
Hope this helps

Source 
https://stackoverflow.com/questions/30045809/viewing-and-updating-data-throught-modal-box-in-laravel

Thursday 21 December 2017

Bootstrap Template Admin Starter Pack

Soft Admin
http://www.toriandmatt.com/softadmin/index.html

SB Admin 2
https://blackrockdigital.github.io/startbootstrap-sb-admin-2/pages/index.html

Wednesday 20 December 2017

Send SMS Laravel Nexmo

References

Basic Tutorial
https://laravel-news.com/sending-receiving-sms-laravel-nexmo

Basic SMS guide
https://developer.nexmo.com/messaging/sms/overview

Through Packagist guide
https://packagist.org/packages/nexmo/client

Some Problem that might occured :

cURL error 60: SSL certificate problem: self signed certificate in certificate chain

While on local-host with Laravel you can easily bypass cURL error.
navigate to Client.php file (vendor\guzzlehttp\guzzle\src\Client.php)
Change "verify" to false
$defaults = [
        'allow_redirects' => RedirectMiddleware::$defaultSettings,
        'http_errors'     => true,
        'decode_content'  => true,
        'verify'          => false,
        'cookies'         => false
    ];