PHP code example of iantoo / laravel-greeting-package
1. Go to this page and download the library: Download iantoo/laravel-greeting-package library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
iantoo / laravel-greeting-package example snippets
'locale' => 'sw',
namespace App\Http\Controllers;
use Iantoo\GreetingPackage\Greeting;
class DashboardController extends Controller
{
public function index()
{
$greeting = Greeting::greet();
return view('dashboard', compact('greeting'));
}
}
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Iantoo\GreetingPackage\Greeting;
class HomeController extends Controller
{
public function index()
{
$currentDate = Greeting::currentDate();
return view('home', compact('currentDate'));
}
}
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Iantoo\GreetingPackage\Greeting;
class ShowCurrentDate extends Command
{
protected $signature = 'date:show';
protected $description = 'Display the current date';
public function handle()
{
$this->info('Today is ' . Greeting::currentDate());
}
}