PHP code example of zhenmu / laravel-init-template
1. Go to this page and download the library: Download zhenmu/laravel-init-template 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/ */
zhenmu / laravel-init-template example snippets
app/Http/Controllers/Controller.php
namespace App\Http\Controllers;
use ZhenMu\LaravelInitTemplate\Http\Controllers\BaseController as BaseController;
class Controller extends BaseController
{
}
app/Models/User.php
namespace App\Models;
class User extends \ZhenMu\LaravelInitTemplate\Models\User
{
}
app/Models/Demo.php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
class Demo extends \ZhenMu\LaravelInitTemplate\Models\BaseModel
{
use HasFactory;
protected $guarded = [];
}
php artisan jwt:secret
JWT_SECRET=
# minutes of 3 day
JWT_TTL=4320
app/Http/Controllers/AuthController.php
use ZhenMu\LaravelInitTemplate\Traits\JwtLoginControllerTrait;
class AuthController extends Controller
{
use JwtLoginControllerTrait;
/**
* Create a new AuthController instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth', ['except' => ['login']]);
}
}