Tagged: 5.7

global variable for all controller and views in Laravel 0

global variable for all controller and views in Laravel

Today, We want to share with you global variable for all controller and views in Laravel.In this post we will show you set global dynamic variables in Laravel 5.8, hear for Laravel define global constants Config php file we will give you demo and example for implement.In this post, we will learn about How to set a variable inside Laravel’s blade template with an example.

global variable for all controller and views in Laravel

There are the Following The simple About global variable for all controller and views in Laravel Full Information With Example and source code.

As I will cover this Post with live Working example to develop How to define Global Variables in Laravel 5.8?, so the Laravel 5.8 – global and dynamic variable for this example is following below.

How to create global variable in laravel 5.6?

config/global.php

set simple your array here.

return [
  'website_title' => 'pakainfo Blog',
  'pagination' => 10,
  'tagLine' => 'Welcome to pakainfo website Love You',
  'API_KEY' => 'hjh566s5df$#FDsf45f4df7ds8ds',
];

Use in your laravel blade view file.

{{ config('global.website_title') }}

{{ config('global.tagLine') }}

Web Programming Tutorials Example with Demo

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about global variable for all controller and views in Laravel.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Check if row exists using Laravel 0

Check if row exists using Laravel

Today, We want to share with you Check if row exists using Laravel.In this post we will show you laravel check if record exists, hear for laravel 5.7 check if record exists we will give you demo and example for implement.In this post, we will learn about laravel validation check if exists in database with an example.

Check if row exists using Laravel

There are the Following The simple About Check if row exists using Laravel Full Information With Example and source code.

As I will cover this Post with live Working example to develop check if record exists in laravel, so the check object null in laravel for this example is following below.

Laravel Checking If a Record Exists

Example: How to check if record exists or not in Laravel 5.8

$product = Product::where('category_id',Input::get('category_id'))->first();

if (is_null($product)) {
   print_r("category is exists");
}
   print_r("category is not exists");
   

Web Programming Tutorials Example with Demo

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Check if row exists using Laravel.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Laravel Remove Public From URL Steps 0

Laravel Remove Public From URL Steps

Today, We want to share with you Laravel Remove Public From URL Steps.In this post we will show you Remove “public” in URL in Laravel 5.7 Step By Step, hear for Laravel 5.7 – Remove Public from URL using htaccess we will give you demo and example for implement.In this post, we will learn about How to Remove Public Directory in Laravel 5.5, 5.6, 5.7 with an example.

Laravel Remove Public From URL Steps

There are the Following The simple About Laravel Remove Public From URL Steps Full Information With Example and source code.

As I will cover this Post with live Working example to develop how to remove public from url in laravel on server,, so the some laravel 5.7 remove public from url for this example is following below.

Step 1: Rename File

Laravel’s .htaccess to remove “public” from URL

simple change your server.php file in the root file to index.php

//Rename 
server.php 
//in your Laravel root folder to 
index.php

Step 2: Update .htaccess

Simple Your .htaccess file and put it laravel Main root folder

Options -MultiViews -Indexes

RewriteEngine On

# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]


# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]

 
# Handle Front Laravel Controller...
RewriteCond %{REQUEST_URI} !(\.css|\.js|\.png|\.jpg|\.gif|robots\.txt)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]


RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/public/
RewriteRule ^(css|js|images)/(.*)$ public/$1/$2 [L,NC]

Laravel 5.* Project- Remove public from URL

Move Laravel Project From localhost to live production server : More Easy MethodsRemoving PUBLIC from URL in Laravel

Change:
require __DIR__.'/../bootstrap/autoload.php';
to:
require __DIR__.'/../laravel/bootstrap/autoload.php';
----------------------------------
Change:
$app = require_once __DIR__.'/../bootstrap/app.php';
to:
$app = require_once __DIR__.'/../laravel/bootstrap/app.php';

Note : And Last You remove all cache and cookies.

Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Laravel Remove Public From URL Steps.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Clear All Cache From Laravel project 5.7 0

Clear All Cache From Laravel project 5.7

Today, We want to share with you Clear All Cache From Laravel project 5.7.In this post we will show you How to clear config cache in Laravel using Artisan, hear for Laravel 5.7 clear cache from route, view, config and all cache data from application we will give you demo and example for implement.In this post, we will learn about Laravel Clear Cache – How to Clear Cache on Views, Config, Route, etc with an example.

Clear All Cache From Laravel project 5.7

There are the Following The simple About Clear All Cache From Laravel project 5.7 Full Information With Example and source code.

As I will cover this Post with live Working example to develop Clear All Cache From Laravel project 5.7 in controller using route, so the laravel clear bootstrap cache Laravel Clear cache Tutorial With Example for this example is following below.

Laravel 5.7 Clear all cache Examples

laravel clear config cache Example with Laravel Clear Cache Commands

Clear Config cache using Laravel

php artisan config:cache

Laravel Clear View cache

php artisan view:clear

Clear Laravel Route cache:

php artisan route:cache

Clear Cache in Laravel facade value

php artisan cache:clear

Reoptimized class loader in Laravel

php artisan optimize

Laravel 5.7 Clear cache in shared hosting server

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

We can check the Main Website official doc here http://laravel.com/docs/5.0/artisan#calling-commands-outside-of-cli

Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Clear All Cache From Laravel project 5.7.
I would like to have feedback on my Pakainfo.com blog for Clear All Cache From Laravel application 5.7.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Laravel Send Emails Mailgun setup Tutorial 0

Laravel Send Emails Mailgun setup Tutorial

Today, We want to share with you Laravel Send Emails Mailgun setup Tutorial.In this post we will show you Mailgun setup with Laravel 5 example, hear for Emails with Laravel 5.7 Mailables we will give you demo and example for implement.In this post, we will learn about Send email in Laravel through email sending services with an example.

Laravel Send Emails Mailgun setup Tutorial

There are the Following The simple About Laravel Send Emails Mailgun setup Tutorial Full Information With Example and source code.

As I will cover this Post with live Working example to develop Laravel Send Emails Using PHP Mailgun , so the some How To Send Email In Laravel Tutorial for this example is following below.

  • Laravel configration(.env file)
  • Global Setting Of the Mailgun
  • Define Laravel Route
  • Create a Controller
  • Laravel Send Email Template View File

Sttep 1 : setting of the Laravel configration

open .env file and bellow code

add configration on mail Sending Emails with Laravel and Mailgun

MAIL_DRIVER=mailgun
MAIL_HOST=smtp.mailgun.org
MAIL_PORT=587
[email protected]
[email protected]
MAIL_ENCRYPTION=tls

Good, now I required to Include secret key as well as your domain of mailgun send mail api configration. Therefor I make a new account in offical website mailgun.com SignUp and then I registeration and active your simple step to mailgun new account as well as click on simple tabs Like Domails Into Add New Domail button.

Step 2 : Global Setting Of the Mailgun

config/services.php

And then We have to open Laravel services.php file as well as put here simple mailgun configration key and url this way :

 'mailgun' => array(
    'domain' => 'pakainfo.com',
    'secret' => 'key-225487c09e58-056a9e692c96dd832jd0cc',
),

Step 3 : Define Laravel Route

app/Http/routes.php

After I am step 3 ready to each client send mail for first welcome so first usnig laravel 5.4, 5.5, 5.6 and 5.7 make welcome route for email sending.

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

Step 4 : Create a Controller

app/Http/Controllers/SendMailController.php

Good way, Then add simple send mail function in SendMailController.php file there for add Laravel this way :

public function mail()
{
    $client = Client::find(1)->toArray();
    Mail::send('emails.simpleSendMailTemplate', $client, function($message) use ($client) {
        $message->to($client->email);
        $message->subject('Laravel Mailgun Testing');
    });
    dd('Mail Send Successfully');
}

Laravel mailgun Send Mail
////////mailgun///////////
      try {
            $data = [
                'title'=>'Email'
            ];
            $sent = Mail::send('emails.simpleSendMailTemplate', $data, function($message) {
                $message->from('[email protected]', 'Example Person');
                $message->to('[email protected]');
                $message->subject('Laravel Send Emails Mailgun setup Tutorial - Mailgun Testing');
            });
            if( ! $sent) dd("something wrong");
            dd('Mail Send Successfully');
        }
        catch (GenericHTTPError $e) {
           // return $e->getMessage();
            dd($e->getMessage());
        }

Step 5 : Laravel Send Email Template View File

resources/views/emails/simpleSendMailTemplate.blade.php

At Final step to make Laravel email template file for mailgun send mail therefor let’s make a simpleSendMailTemplate.blade.php file in emials folder.

<h1>Laravel Send Emails Mailgun setup Tutorial</h1>
Hi, I am from pakainfo.com from mailgun testing.

Thanks
Jaydeep Gondaliya

Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Laravel Send Emails Mailgun setup Tutorial.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.