tritue.edu.vn


Thiết lập thông tin chung của toàn bộ dự án

Để lấy thông tin thiết lập chung của project (như tên project, email chủ sở hữu, địa chỉ...) để hiển thị ở cuối trang (footer) hoặc bất kỳ đâu, bạn nên lưu các thông tin đó ở một nơi tập trung, và cách chuẩn nhất là: Dùng file .env + config config/app.php (chuẩn Laravel)

 

 



Bước 1: Thêm vào file .env

Copy
         

APP_NAME="Xep Lich Tuệ Tâm"
APP_OWNER_EMAIL=owner@example.com
APP_OWNER_NAME="Tuệ Tâm"
APP_ADDRESS="123 Đường Laravel, Hà Nội"
 


Bước 2: Thêm vào config/app.php

Copy
         

'owner' => [
    'name' => env('APP_OWNER_NAME', 'Admin'),
    'email' => env('APP_OWNER_EMAIL', 'admin@example.com'),
    'address' => env('APP_ADDRESS', 'N/A'),
],
 


Bước 3: Hiện thông tin trong Blade (ví dụ layouts/user.blade.php)

Copy
         

<footer class="text-center text-muted mt-5">
    <hr>
    <p>&copy; {{ config('app.name') }} - Liên hệ: {{ config('app.owner.email') }} - Chủ sở hữu: {{ config('app.owner.name') }}</p>
</footer>
 


Ví dụ mẫu footer với bootstrap

Copy
         

<footer class="bg-light text-center text-lg-start mt-5 py-3 border-top">
    <div class="container">
        <span class="text-muted">
            &copy; {{ date('Y') }} {{ config('app.name') }} |
            Liên hệ: <a href="mailto:{{ config('app.owner.email') }}">{{ config('app.owner.email') }}</a> |
            Chủ sở hữu: {{ config('app.owner.name') }}
        </span>
    </div>
</footer>
 




Link chia sẻ bài viết
Copy
            https://tritue.edu.vn/tuecode/tracnghiem30/index.php/baiviet/post/view/id/235?id=235         

Bài viết liên quan