Bulk SMS Kenya: Should you Choose SMS or Push Notifications for your App?

Bulk SMS Kenya is a service that many app owners do not think about until the last minute. The greatest concern is always the number of downloads. When thousands of people download an app, the owner relaxes and assumes all is well.

The expectation is that the engagement rate will increase with each new download. Here is the reality. Downloads do not lead to engagement. You must give users reasons to open your app every day where possible.

Two ways to do that is through push notifications and SMS. The effectiveness of these methods of communication is the subject of this discussion. Let us start with the definitions.

Definitions of Push Notifications and SMS

Push notifications are messages that an app send from its server to the user’s interface. The user view notifications on the mobile device or desktop depending on the settings. Some apps allow users to choose the type of notifications that an app sends to their interface.

Apple was the first company to introduce the service in 2009 before Google introduced its service in the following year. Since then, companies have been adopting the form of communication for their solutions. The trend has been introduced in mobile apps development as well.

SMS stands for Short Message Service. Text messages have existed throughout the history of mobile phones. However, their popularity increased in the 1990s when companies adopted the service for commercial activities.

Bulk SMS Kenya is a popular service. It has attracted many providers because of the increasing demand. As mobile apps and e-commerce platforms become popular, entrepreneurs realise the need to invest in the service.

Mobile Engagement through Push Notifications

It is important to note that every method of user engagement has its pros and cons. Push notifications offer the option of combining both text and images. The notifications often play a sound and show an icon to alert the user.

You can play around with notifications to include interactive buttons that allow users to respond to the notification. Push notifications are associated with a higher level of user engagement. They do not just remind the user of the app but prompt a specific action.

By clicking on the notification, the user may go directly to the app when a link is provided. Another advantage is that users can opt or out of the notification. Users can either block all notifications from the settings or choose the type of notifications to receive.

The downside of push notifications is that is they can be disruptive and annoying. Think of apps that are highly interactive such as social apps. Notifications for every time a connection takes actions are too much for some users.

Users end up either blocking all notifications or logging out of an app. Such actions mean loss of opportunities to convert for app owners. Hence, the timing and content of notifications must be right.

One advantage of push notifications over SMS is that they are free and unlimited. As a mobile app owner, you can send as many notifications as necessary at no cost. Some companies that offer Bulk SMS Kenya charge after a specific number of messages.

Push notifications are suitable for apps whose functions require constant reminders. For instance, fitness apps need to send constant reminders to users to work out. Users sign up for social apps for engagement with other users and so push notifications are less disruptive.

Bulk SMS Kenya

Travel apps such as airline apps need to send notifications to users to remind them of scheduled flights. In short, if you need to remind users of important activities or actions, push notifications are recommended.

For push notifications to work as intended, avoid sending them in the morning. Nobody wants to wake up to the sound of a notification.  Avoid sticky notifications and ensure that the message is relevant.

You do not need to send a notification every day unless your app requires that. For instance, working out or adopting a new diet requires daily reminders. Make the messages relevant, useful, and engaging at all times.

Engagement through SMS

The alternative to push notifications is SMS. Some apps require that you use both bulk SMS and push notifications. Why send text messages while you can send notifications? One, you may need to confirm the identity of users.

Consider finance apps or delivery services that require user authentication. The mobile phone number is often part of the verification process. You need to send a message to confirm registration or provide a verification code.

Delivery and transport services require SMS services. Think of users that book a service online and then switch off their data. How do you deliver their orders without an alternative communication channel?

Transport companies will often send a message to both the client and courier to confirm an order and delivery time. You can also send alerts or warnings to clients via SMS. For instance, you will find banks sending SMS alters to all clients of new fraudulent activities.

Healthcare services use SMS to reach a wider market with warning or alerts of outbreaks or new services. Text messages are a great way of introducing discounts or offers to clients. Clients are prompted to log into the apps and view the products or services on offer.

The downside of SMS is that they may attract an additional cost.  Bulk SMS Kenya is free to a limited number of messages. Sometimes you may need users to reply to a message, which attracts a cost for them as well.

Another downside of using SMS is that some users consider them as spam. It is difficult to personalise every SMS. Hence, companies end up sending the same message to all clients. Sometimes the same message will appear in a day and users dismiss them as spam.

Conclusion

Choosing the right engagement tool is now easy with this information. The first question to ask before contacting any service provider or developer is, does my app need this service? Will it improve communication with clients or annoy them? Consider the type of app you have developed and the kind of alerts that the user needs. Think about the frequency and timing of both SMS and push notifications to maximise on open rates. Remember that Bulk SMS Kenya services may attract a cost. There is no harm in exploring both tools at the same time to optimise user engagement.

Show us some Love:

Google Maps Integration: Benefits of Using Maps on your Website

Have you considered Google maps integration for your business website? Embedding maps on your site does more than giving directions. Try to search for your top competitors online. Alternatively, search for the most competitive keyword in your niche on the search engines.

The first result you are likely to get on Google is a map with the location of different competitors. When you follow them to their website, you will find a location pin on their home page and contact page. Compare the results with your own website. Which business are customers likely to choose?

Sometimes business owners miss opportunities to grow their businesses because of a lack of knowledge. If you are still unsure about this, let us look at the benefits that your business is missing for operating without maps.

Marketing your business

By embedding Google maps on your website, you increase the visibility of your business. As mentioned in the introduction, search engine results often start with maps depending on the search query. If your business is within the location of the client, it will pop up among the results.

Do not allow your competitors to outdo your business on this. Seek Google maps integration services if you do not know how to use the API. The advantage of using developers is that the integration will be done within a short time. Your team continues with other operations while developers handle the technical bit.

Building trust

Sometimes it helps to think as a client while trying to get into the mind of your target audience. In a world on online businesses, many clients still trust companies with a physical store. You have an advantage over online businesses that have no physical location.

It is now time to use that advantage well. This does not mean that you ignore of online transactions. Most of your customers will still search for more information about your business online. However, they will gain trust in your brand since they know where to find you. Some will complete their orders online but a good number will visit your store.

One of the reasons why clients trust businesses with a physical location is handling complaints. If you have your ears on the ground, you will notice that many online shoppers are disappointed because of unmet expectations. With an embedded map, clients know where to return products or ask for a replacement when disappointed.

Connecting with your target audience

Your target audience includes potential clients in your neighbourhood. If not, you need to rethink your marketing goals and approach. Consequently, your marketing strategies should include local search engine optimization. Search engines sometimes recommend service providers based on the user’s IP address. Your business will rank high by location to clients in your area.

After the aggressive marketing campaigns to drive internet users to your website, let them know where to find you. Your target clients will easily connect with you by following the map on your site. Ensure that the pin is correct and visible.

Google maps integration goes hand in hand with other contacts. For instance, clients need a phone number to call in case they get lost while following the maps. Some will want to chat or send an email before visiting your store. Ensure that the working hours are clearly displayed as well.

Google maps integration

Suggesting transportation modes

Google Maps gives users all the transportation modes available to their destination. In some cities, it is possible to view bus and train schedule directly on the maps. For those using public transport, the drop off points or bus terminus are critical.

The routes for private vehicles and nearby buildings are visible as well. In other words, your clients can pin point the location of your business and have a clear path of their way to that location. The maps help them determine the best mode of transport to use.

On the flip side, the location of your business on Google maps can help you make some decisions. For instance, if you are in area that is not visible on maps, it might help to move to a new location. You do not need to change cities but find a more visible building within the same area.

User-oriented service
Google maps integration for WordPress websites and other sites gives users a personalised experience. The service presents your business as an easy and available service. Clients are looking for the easiest and fastest way to get a product or service.

Maps integration gives clients that impression. Your business appears as an easy way of meeting their need.  In other words, you are making life easier for your clients. You might not be the best in your industry but the ease of access will give you a cutting edge.

Google has made it so easy for users to use maps. Your clients do not need any advanced skills to use the plugin on their devices. Your part is to include the right pin on your website and make it visible. Have you not received enough calls from clients asking for directions?

Cost effective

Do we need to mention the cost of maps integration? It might be the cheapest marketing strategy you have invested in since your business began. In other words, you have no reason for leaving out Google maps. The cost of integration is low.

Developers will help you integrate maps on your website at an affordable rate. Do not shy away from asking for help even if your business is old. Knowledge is only useful if you apply it. You do not need the technical skills to embed maps. Let developers do it while you keep growing your business.

Final remarks

It is evident from the discussion that your business is missing growth opportunities without maps. Do not wait until your business grows to implement market strategies. Right now while you are trying to build your client base, use all means to attract customers. Google maps integration in Kenya is for both large and small businesses. The returns are incomparable to the cost of investing in this service.

Show us some Love:

Why are Instant Loans Popular in Kenya Despite Metropol CRB Listings?

Metropol CRB is top of the list of credit reference bureaus in Kenya. A financial institution can limit your chances of getting a loan by submitting your name to this bureau. Some employers have also been using credit reports to narrow their list of candidates.

The consequences of a CRB listing are supposed to push defaulters to fulfil their obligations. Some financial institutions use them as a way of reminding borrowers to pay their dues on time. However, many Kenyans seem unbothered with CRB listings.

The demand for unsecured loans has been increasing over the years. Banks have been very aggressive in selling these loans to their clients. The target for such loans is, in most cases, salaried customers. It is easy to deduct instalments directly from their paycheck.

The introduction of loan apps has increased the popularity of instant loans. You can hardly scroll your phone without interruption of an ad for a loan app. Thousands of Kenyans are downloading these apps to get quick cash.

The repayment period for most mobile loans is stretched over a month. The possibility of repaying and getting a new loan immediately keeps many borrowers hooked. The new loan may be a higher amount depending on the app.

Read Also: The Top 5 Instant Loan Apps in Kenya

For most loan apps, repaying on time means that you can grow your credit limit. Hence, borrowers strive to repay on the due date and then borrow almost immediately. The sad part is that most borrowers have several loans from different apps.

Having several loans at the same time means that the borrower is borrowing from one to pay the other. In addition, Kenyans are losing lots of money in terms of interest rates. The game ends when one is unable to keep up with the interest rates and defaults.

Lenders follow the legal procedure to demand repayment. Eventually, defaulters end up at Metropol CRB Kenya or Transunion CRB. However, the effects of defaulting do not seem to deter Kenyans from seeking new loans.

Metropol CRB Kenya

Do lenders still check the credit score of borrowers? While are instant loans still popular even with credit reference bureaus in place?

1. Ease of access

Many Kenyans borrow simply because they can. The ads for instant loans are so enticing and convincing. As the competition among lenders rise, creative ads have flooded the television stations. You come across several billboards as you drive around reminding you of an easy loan.

The convenience of applying on a mobile device is also inviting. The processing is simple, private, and fast. In fact, loan apps process requests within minutes. The process is even faster for borrowers with a clean financial record.

Banks have also improved the process of issuing unsecured loans. Partnerships with mobile money services such as M-pesa and Airtel Money have simplified lending. The highest percentage of Mpesa customers has tried the Mshwari services.

Safaricom’s partnership with Equity Bank and KCB has made it easy for Kenyans to access unsecured loans. Most lenders target business owners but end up with individuals. The trend will continue as other banks and SACCOs explore such partnership.

2. Harsh economic times

Kenyans are not just borrowing for the fun of it. The tough economic times have made instant loans an easy option for many families. The high unemployment rate among young people has turned them into borrowers.

As Kenyans continue to raise alarm concerning the huge government loans, the effects are trickling down to household. High taxation rates and high lending rates have slowed the growth of businesses.

Have you noticed the timing of advertisement for instant loans? They seem to pop up when you really need cash. Well, the ads are meant to do just that, entice you to apply for a quick loan. You are not alone. Thousands make the same decision every month.

READ ALSO: Top 10 Mobile App Categories as Analysed by Android App Designers in Kenya

3. No collateral required

Many defaulters whose names appear on Transunion CRB or Metropol CRB owe small amounts. Banks and other lenders do not require any security when issuing instant loans. A good credit score is the most important requirement.

If you dream of owning a loan app, CRB integration is necessary. You cannot rely on a client’s income alone to determine creditworthiness. Some app owners ignore bad credit but compensate the convenience with high interest rates.

Security is necessary for large amounts of money. However, most borrowers seeking instant loans need less than Ksh.50,000. Most loan apps limit the loanable amount at this level. It takes a while to qualify for the maximum amount.

4. Flexible repayment periods

Borrowers have a month to repay instant loans. The promise of a higher loan limit encourages borrowers to repay on time. Some mobile apps offer loans payable within 3 weeks. As long as the loan is paid on time, the borrower does not incur any penalties.

A month is a long time for small amounts. However, as the loan amount increases, repaying within a month with the interest becomes a challenge. Sometimes lenders reduce the loan amount drastically without informing the borrowers.

For the borrowers who repay to borrow again, such changes affect their ability to repay other loans. The result is several months of constant reminders to repay. When lenders exhaust all means of recovering their money, they list the default with a credit reference bureau.

5. Data security

When mobile loans were fast introduced, many borrowers were concerned about their personal information. The concern is still there but lenders have managed to convince borrowers of data security. Most app owners guarantee the same level of security as banks.

While security remains a concern, the pressing needs sometimes overshadow the concern. Borrowers are on many occasioned concerned about the quickest solution. Nevertheless, financial institutions play their part in securing personal data.

Our final thoughts

Instant loans will continue to trend as long as the competition in the financial markets remains. Every bank wants a big share while many SACCOs have transformed into banks. You too can be part of the big players. We help institutions and individuals develop agile loan apps.

Muva offers Metropol CRB integration and other bureaus as well. However, you need to educate your borrowers on the right reasons for applying for loans. It is easy to share financial tips when lending through a loan app.

Show us some Love:

The Most Popular Payment Gateways in Kenya

The first idea that comes to mind when payment gateways are mentioned is Mpesa API integration in Kenya. The thought is expected given the popularity of Mpesa payments in the country for online and over the counter transactions. However, not all customers that visit your online store prefer Mpesa payments. You need to consider more than one payment option to capture all segments in your target market.

Before we talk about the specific payment gateways, let us look at the factors to consider when comparing the gateways. You have many choices in the market but not all will work for your e-commerce business. Choose a payment gateway based on the following factors:

1. Security

Clients provide their confidential information at checkout if they trust the payment gateway. Choose a reputable gateway with positive feedback from previous buyers in terms of security. The providers must care for the users’ security enough to include the best security technology in their payment gateway. The best gateways offer bank-level security and bear SSL certificates that meet industrial standards. Given the importance of safety to buyers, cross check the security measures beyond the promotional messages

2. Fees charged

How much will you spend every month or year for the payment gateway? The safest gateways often attract high integration and maintenance fees. Compare the fees charged for each transaction, report, and account fees among other cost items. The cost of the online payment gateway should be reasonable depending on your earnings from the e-commerce platform.

3. Compatibility

How well does the payment gateway integrate into your e-commerce platform? The integration process should be smooth and easy for developers. Compatibility also influences the users’ experience on your platform. The experience should give clients confidence in your brand from the start to the end of every transaction.

4. Location

We are looking at payment gateways in Kenya but as you will soon discover, some are located in other countries. Clients complete the transaction smoothly on your platform but the site directs them to a third-party site at checkout. Others allow clients to complete the transaction on the same website. The best choice depends on the type of experience you want to give your clients. Some clients shy away from payments when directed to a new website.

5. Acceptable payment methods

Some payment gateways allow a specific mode of payment while some incorporate several payment methods. The decision here depends on your target clients, their location, and preferences. The reality is that one payment option might not work for all clients at all times. It is safer to give several methods even if the majority of the clients settle for one payment method.

Payment gateways in Kenya

You can choose any of the following payment gateways based on the criteria discussed in the previous section.

Mpesa API

Mpesa comes first on the list because most of the payments you will receive from Kenyan clients will come through mobile money. While other mobile money services are available, Mpesa is the most popular. Many online entrepreneurs prefer Mpesa API integration in Kenya because clients trust the payment method. Safaricom Limited has done its best to ensure that the payment method is safe. The process of Mpesa integration is simple, fast, and compatible with most e-commerce platforms.

JamboPay

The gateway offers several payment options for over-the-counter and online purchases. The payment methods include Mpesa, MasterCard, Airtel Money, Visa cards, Elma, and Kenswitch. The advantage of integrating this payment gateway is that your clients will have more than one payment method to use at checkout. The payments are fast and secure. The gateway is approved by the Central Bank of Kenya and has the best SSL certificates in the industry for data encryption.

PesaPal

The payment gateway offers more than ten payment methods including Visa, MasterCard, Mpesa, Airtel Money, Equity Bank, Co-operative Bank, American Express, and PesaPal E-Wallet. The gateway guarantees its users of bank-level security. PesaPal is available for personal and business online transactions. The gateway has attracted top companies across all industries including banking, hotels, and telecommunication among others.

MasterCard

MasterCard is one of the most secure methods of payment for online businesses. The payment gateway will work best for businesses that target both local and international clients. The gateway is trusted around the world for its top security systems. It is easy to detect fraud when using MasterCard. The only challenge with the payment gateway is the fees charged for integration. Unlike other payment gateways, you need qualified developers to create a good e-commerce platform that is compatible with MasterCard.

Shopify

The gateway is becoming popular in Kenya and other countries in Africa. Shopify offers several payment methods including Pay Gate, Bit Pay, PayPal Express Checkout, PesaPal, and Go Coin. Although most of the payment methods suit international trade, the gateway enables users to pay in their local currencies.

Direct Pay Online (DPO)

Direct Pay Limited targets travel-related companies including hotels, airlines, tour guides, and travel agents. The platform is also available to other e-commerce merchants and to individuals for paying utility bills. The company has expanded its reach to other African countries including Ethiopia, Botswana, Mauritius, Ghana, and Namibia among others. The payment options via this gateway include Mpesa, Airtel, Tigo, Voda, MTN, Visa, MasterCard, PCI, American Express, and Pesa.

MobiCard Systems

The payment gateway enables merchants to accept card and mobile payments from online buyers. The system operates under a bank-grade security system and does not store the clients’ card information on its servers. Signing up for a MobiCard enables you to receive Visa and MasterCard payments. You can also receive Mpesa payments on the same system. The service provider has streamlined the payment options to the most popular payment methods in Kenya.

Mula

The payment gateway provides an easy, fast, and secure way for clients to make payments across Africa. Users can pay bills or buy airtime within seconds. Entrepreneurs can receive payments for their social commerce products or any other product offered online. The gateway customizes the payment methods to suit the location of the user.

Final Remarks

You can tell from this list that you have several payment gateways to consider apart from Mpesa Integration in Kenya. However, you must do your part and assess the security for each gateway before integrating it into your website. It is also important to test the flow of payments to give your clients the best experience on your platform. Check the availability of the support team in case technical issues arise after integration.

Show us some Love:

Lesson 10: Showing post in our frontend page in Our Blog Application in Laravel 5.5

Welcome to this lesson, great to have you on board. My name is Henry and I am excited to continue with this tutorial series where we are building blog application using Laravel 5.5 and PHP 7.0.0. We are at the tenth section, showing our post in our frontend page. In our previous sections, we implemented the ability to update post, delete post and hopefully by now you are getting comfortable in Laravel file structure , in this lesson we are going to deal with the ability to show our posts in our frontend page.

I will run the following command: php artisan serve to make sure my development server is up and running. On my browser

We are only showing dummy data in this page, not too bad and not too nice. I want to actually output post from our database and that way our blog will be dynamic. In order to show post from our database, I will need to fetch the posts. The first thing I am going to do is to create a new controller. On my terminal I will navigate to my project folder and run the following command: php artisan make:controller PostController here is the output of my terminal:

If you open your controllers folder you will have the following file structure:

Now open PostController.php file and make sure it has the following code:

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;

class PostController extends Controller
{
    public function getIndex() {
        $posts = DB::table('users')->leftjoin('posts', 'users.id', '=', 'posts.author')->paginate(2); 
        return view('post/index', ['posts' => $posts);
    }
}

Let’s understand the code:

  • On line 6, I am importing DB facades provided by Laravel in order to use query builder.

  • From line 10 – 13, I have created a function called getIndex().

  • On line 11, I have created a variable called $posts, and am fetching posts using DB facade to build a queryset. At the end I am passing a paginate() class which will help us in creating paginate dynamically.

  • On line 12, I am returning a our view which is called index and I am also passing an array of posts to index.blade.php file.

The next step is to update our web.php file to make sure our index url is pointing to the correct PostController.php. Open web.php and make sure it has the following code:

<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', 'PostController@getIndex')->name('index');

Auth::routes();

Route::get('/home', 'HomeController@index')->name('home');
Route::get('/author/post', 'HomeController@getPostForm')->name('post.form');
Route::post('/author/post', 'HomeController@createPost')->name('post.form');
Route::get('/author/post/detail/{id}', 'HomeController@getPost')->name('post.detail');
Route::get('/author/post/edit/{id}', 'HomeController@editPost')->name('post.edit');
Route::post('/author/post/edit/{id}', 'HomeController@updatePost')->name('post.update');
Route::get('/author/post/delete/{id}', 'HomeController@deletePost')->name('post.delete');

On line 14, I have updated our route to use our controller. The next step is to update our index.blade.php file with the following code:

@extends('layouts.master')

@section('title')
    Welcome Laravel Blog Tutorial
@endsection

@section('content')
    <main role="main" class="container"  style="margin-top: 5px">

        <div class="row">

            <div class="col-sm-8 blog-main">

               @foreach($posts as $post)
                    <div class="blog-post">
                        <h2 class="blog-post-title">{{ $post->title }}</h2>
                        <p class="blog-post-meta"><small><i>{{ Carbon\Carbon::parse($post->created_at)->format('d-m-Y')  }} by <a href="#">{{ $post->name }}</a></i></small></p>

                        <p>{!! \Illuminate\Support\Str::words($post->description, 30, '...') !!}</p>
                        <blockquote>
                            <p>
                                <a href="{{ route('post.read', ['post_id' => $post->id]) }}" class="btn btn-primary btn-sm">Learn more</a> </p>
                        </blockquote>
                    </div><!-- /.blog-post -->
                @endforeach

                <nav class="blog-pagination">
                    {{ $posts->links() }}
                </nav>

            </div><!-- /.blog-main -->

            <aside class="col-sm-3 ml-sm-auto blog-sidebar">
                <div class="sidebar-module">
                    <h4>Latest Posts</h4>
                        <ol class="list-unstyled">
                            <li><a href="">March 17</a></li>
                             <li><a href="">March 17</a></li>
                        </ol>
                </div>
            </aside><!-- /.blog-sidebar -->

        </div><!-- /.row -->

    </main><!-- /.container -->
@endsection

Let’s understand the code:

  • From line 14 – 25, I have created a loop to display the posts from the database.

  • On line 16, I am displaying the title of the post.

  • On line 17, I am using Carbon to display the created date of the post in human friendly way, I am also displaying the name of the author of the post.

  • On line 19, I am importing a laravel facades to help me truncate my posts description, in my case I am truncating using 30 words.

  • On line 22, I have a button that will be used to read the full blog post. For now, this button is not doing anything.

  • On line 28, I am creating pagination of my blog post. If you recall, I used paginate() class in my queryset.

Run you development server using php artisan serve command. Navigate to your browser at http://localhost:8000/ and you should see the following screen-shot:

We are now showing post from our database, try and click on the pagination links below your posts and see what happens.

The next step to work on our right side navbar. I want to show a list of latest posts based on their dates. Open our PostController.php file and make sure it has the following code:

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;

class PostController extends Controller
{
    public function getIndex() {
        $posts = DB::table('users')->leftjoin('posts', 'users.id', '=', 'posts.author')->paginate(2);
        $archives = DB::table('posts')->orderBy('id', 'DESC')->get();

        $data = array(
            'posts' => $posts,
            'archives' => $archives
        );
        return view('post/index', $data);
    }
}

Let’s understand the code:

  • On line 12, I have created another queryset and this time I am ordering post by latest id using descending method.

  • From line 14 – 17, I am creating an array of my queries in order to pass them as one variable called $data. Sometimes, you will find yourself in some sticky situation where you need to pass different data to one view. This is one way to solve that problem.

  • On line 18, I am returning my view with my $data variable.

The next step is to update our index.blade.php file, make sure it has the following code:

@extends('layouts.master')

@section('title')
    Welcome Laravel Blog Tutorial
@endsection

@section('content')
    <main role="main" class="container"  style="margin-top: 5px">

        <div class="row">

            <div class="col-sm-8 blog-main">

               @foreach($posts as $post)
                    <div class="blog-post">
                        <h2 class="blog-post-title">{{ $post->title }}</h2>
                        <p class="blog-post-meta"><small><i>{{ Carbon\Carbon::parse($post->created_at)->format('d-m-Y')  }} by <a href="#">{{ $post->name }}</a></i></small></p>

                        <p>{!! \Illuminate\Support\Str::words($post->description, 30, '...') !!}</p>
                        <blockquote>
                            <p>
                                <a href="{{ route('post.read', ['post_id' => $post->id]) }}" class="btn btn-primary btn-sm">Learn more</a> </p>
                        </blockquote>
                    </div><!-- /.blog-post -->
                @endforeach

                <nav class="blog-pagination">
                    {{ $posts->links() }}
                </nav>

            </div><!-- /.blog-main -->

            <aside class="col-sm-3 ml-sm-auto blog-sidebar">
                <div class="sidebar-module">
                    <h4>Latest Posts</h4>
                    @foreach($archives as $archive)
                        <ol class="list-unstyled">
                            <li><a href="{{ route('post.read', ['post_id' => $archive->id]) }}">{!! \Illuminate\Support\Str::words($archive->title, 6, '...') !!}</a></li>
                        </ol>
                    @endforeach
                </div>
            </aside><!-- /.blog-sidebar -->

        </div><!-- /.row -->

    </main><!-- /.container -->
@endsection

Let’s understand the code:

  • From line 36 – 40, I have created a new loop to show the latest posts.

  • On line 38, I am showing the latest posts based on their title.

On browser, reload the page and you should see the following screen-shot:

The next step is to make sure our read more button is working, open PostController.php file and make sure it has the following code:

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;

class PostController extends Controller
{
    public function getIndex() {
        $posts = DB::table('users')->leftjoin('posts', 'users.id', '=', 'posts.author')->paginate(2);
        $archives = DB::table('posts')->orderBy('id', 'DESC')->get();

        $data = array(
            'posts' => $posts,
            'archives' => $archives
        );
        return view('post/index', $data);
    }

    public function getFullPost($post_id) {
        $post = DB::table('users')->leftjoin('posts', 'users.id', '=', 'posts.author')->where('posts.id', '=', $post_id)->first();
        return view('post/read', ['post' => $post]);
    }
}

Let’s understand the code:

  • From line 21 – 24, I have created a new function called getFullPost($post_id) where I am passing the id of the post to this method.

  • On line 22, I have created a queryset where I am joining two tables namely users and posts. I am also using another method known as where the post id in our database is equal to the one being passed to this function.

  • On line 23, I am returning a view called read located inside our post folder.

The next step is to create read.blade.php file inside our post folder. Make sure that read.blade.php file has the following code:

@extends('layouts.master')

@section('title')
    Welcome Laravel Blog Tutorial
@endsection

@section('content')
    <main role="main" class="container"  style="margin-top: 5px">

        <div class="row">

            <div class="col-sm-8 blog-main">
                    <div class="blog-post">
                        <h2 class="blog-post-title">{{ $post->title }}</h2>
                        <p class="blog-post-meta"><small><i>{{ Carbon\Carbon::parse($post->created_at)->format('d-m-Y')  }} by <a href="#">{{ $post->name }}</a></i></small></p>

                        <p>{{ $post->description }}</p>
                    </div><!-- /.blog-post -->
            </div><!-- /.blog-main -->

            <aside class="col-sm-3 ml-sm-auto blog-sidebar">
                <div class="sidebar-module">
                </div>
            </aside><!-- /.blog-sidebar -->

        </div><!-- /.row -->

    </main><!-- /.container -->
@endsection

Let’s understand the code:

  • On line 14, I am showing the title of the post.

  • On line 15, I am showing the date when the post created and the name of the author.

  • On line 17, I am showing the full blog post description.

The next step is to create a route for this view to work. Open web.php file and make sure it has the following code:

<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', 'PostController@getIndex')->name('index');

Auth::routes();

Route::get('/home', 'HomeController@index')->name('home');
Route::get('/author/post', 'HomeController@getPostForm')->name('post.form');
Route::post('/author/post', 'HomeController@createPost')->name('post.form');
Route::get('/author/post/detail/{id}', 'HomeController@getPost')->name('post.detail');
Route::get('/author/post/edit/{id}', 'HomeController@editPost')->name('post.edit');
Route::post('/author/post/edit/{id}', 'HomeController@updatePost')->name('post.update');
Route::get('/author/post/delete/{id}', 'HomeController@deletePost')->name('post.delete');
Route::get('/post/read/{post_id}', 'PostController@getFullPost')->name('post.read');

On line 25, I have created a route that goes to our PostController.php at getFullPost method. The last thing we need to do is to update our index.blade.php file. Make sure it has the following code:

@extends('layouts.master')

@section('title')
    Welcome Laravel Blog Tutorial
@endsection

@section('content')
    <main role="main" class="container"  style="margin-top: 5px">

        <div class="row">

            <div class="col-sm-8 blog-main">

               @foreach($posts as $post)
                    <div class="blog-post">
                        <h2 class="blog-post-title">{{ $post->title }}</h2>
                        <p class="blog-post-meta"><small><i>{{ Carbon\Carbon::parse($post->created_at)->format('d-m-Y')  }} by <a href="#">{{ $post->name }}</a></i></small></p>

                        <p>{!! \Illuminate\Support\Str::words($post->description, 30, '...') !!}</p>
                        <blockquote>
                            <p>
                                <a href="{{ route('post.read', ['post_id' => $post->id]) }}" class="btn btn-primary btn-sm">Learn more</a> </p>
                        </blockquote>
                    </div><!-- /.blog-post -->
                @endforeach

                <nav class="blog-pagination">
                    {{ $posts->links() }}
                </nav>

            </div><!-- /.blog-main -->

            <aside class="col-sm-3 ml-sm-auto blog-sidebar">
                <div class="sidebar-module">
                    <h4>Latest Posts</h4>
                    @foreach($archives as $archive)
                        <ol class="list-unstyled">
                            <li><a href="{{ route('post.read', ['post_id' => $archive->id]) }}">{!! \Illuminate\Support\Str::words($archive->title, 6, '...') !!}</a></li>
                        </ol>
                    @endforeach
                </div>
            </aside><!-- /.blog-sidebar -->

        </div><!-- /.row -->

    </main><!-- /.container -->
@endsection

Let’s understand the code:

  • On line 22, I have added url to our button that goes to the route we have just created.

  • On line 38, I have added url to our latest article list that goes to the route we have just created.

Run you development server using php artisan serve command. Navigate to your browser at http://localhost:8000/ and you should see the following screen-shot:

Click on learn more button and you should see the following screen-shot:

Goals achieved in this lesson

  • We have learnt how to create a controller.

  • We have learnt how to show post to our frontend page.

  • We have learnt how to create pagination.

  • We have a simple content management system.

With that, we conclude our tutorial. Where to take it from here:

  • You can enhance this blog with functionalities like Facebook comment systems.

  • You can add a search functionality.

  • Now you can play around front-end framework like bootstrap.

NB: Now you have a better understanding of how Laravel framework, try and take a different challenge.

With that we conclude our laravel blog tutorial application, to get the code visit building a blog application using laravel.

Show us some Love: