1. Go to this page and download the library: Download yoosuf/calculator 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/ */
Route::get('calculator', function(){
echo 'Hello from the calculator package!';
});
public function boot()
{
//
php artisan make:controller CalculatorController
namespace yoosuf\Calculator;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
class CalculatorController extends Controller
{
//
public function add($a, $b){
echo $a + $b;
}
public function subtract($a, $b){
echo $a - $b;
}
}
public function register()
{
// register our controller
$this->app->make('yoosuf\Calculator\CalculatorController');
}
public function register()
{
// register our controller
$this->app->make('yoosuf\Calculator\CalculatorController');
$this->loadViewsFrom(__DIR__.'/views', 'calculator');
}
public function add($a, $b){
$result = $a + $b;
return view('calculator::index', compact('result'));
}
public function subtract($a, $b){
$result = $a + $b;
return view('calculator::index', compact('result'));
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.