วันอาทิตย์ที่ 20 กันยายน พ.ศ. 2558

laravel กับ Controller does not exist.

เวลาเราเพิ่ม controller และ route แล้ว แต่ก็ยังเจอ Controller does not exist. สั้นง่ายๆ

php artisan dump-autoload
##คำสั่งนี้มีการปรับปรุงไฟล์ vendor/composer/autoload_classmap.php ##
ในกรณีเราเพิ่ม controller ใหม่ใน localhost เมื่อเรา dump-autoload ให้ทำการ upload flie vendor/composer/autoload_classmap.php ไปไว้บน hosting ด้วย

วันอาทิตย์ที่ 13 กันยายน พ.ศ. 2558

วิธีติดตั้ง laravel 4.2 บน hosting จริง

ย้ายทุกอย่างใน folder public มาอยู่บน Document Root

วิธีที่ได้ผลที่สุด แล้วก็ไม่ยาก ใช้ได้แน่ๆก็คือย้ายแอพพลิเคชั่นของเราทั้งหมดไปไว้ที่ root จะเป็น www หรือ public_html หรือ htdocs ก็แล้วแต่จะพิจารณากันตามโฮสท์ใครส่วนใหญ่บ้านเราใช้ DirectAdmin ก็น่าจะ public_html กันเนาะ
ขั้นแรก ย้ายทุกอย่างออกจาก public มาไว้ที่  www  หรือ DocumentRoot
Image title
ขั้นต่อมาก็ลบเจ้าโฟลเดอร์ public ทิ้งซะ ก็จะได้โครงสร้างประมาณนี้
Image title
มีอะไรต้องแก้อีกนิดนึงในไฟล์  bootstrap/paths.php
Image title 
ขั้นตอนสุดท้ายเราต้องเข้าไปแก้พาธในไฟล์ index.phpImage title

ที่มา

วันเสาร์ที่ 5 กันยายน พ.ศ. 2558

วิธี Resize และ Crop รูปภาพใน Laravel 4

Image

A Laravel 4 wrapper for the Imagecow image resizing / respoisive image package. Seehttps://github.com/oscarotero/imageCow for more detail on the underlying image manipulation package.
Image cow can use either GD or ImageMagick to transform image.

Instalation

Install as any other Laravel 4 package:
1) Add to composer:
"require": {
    ...
    "kevbaldwyn/image":"dev-master"
    ...
}
2) Composer Update:
$ composer update
3) Add to the providers array in app.php:
    'providers' => array(

    ...

    'KevBaldwyn\Image\Providers\Laravel\ImageServiceProvider'
)
4) Add to the facades array in app.php:
    'aliases' => array(

    ...

    'Image' => 'KevBaldwyn\Image\Providers\Laravel\Facades\Image'
)
5) Publish the package config file to change the defaults:
$ php artisan config:publish kevbaldwyn/image
6) Copy the /vendor/imagecow/imagecow/Imagecow/Imagecow.js file to a publicly accessible web directory. The default path is set as /public/js/Imagecow.js, but whatever it is set as in the config the file must exist.

Usage

Standard

To provide image links on your templates use like so:
<img src="{{ Image::path('/image.jpg', 'resizeCrop', 400, 200) }}" />
Where the first argument is the image which is referenced from the root of the public directory. The second argument is the transform method and each subsequent argument is an argument that would be passed to the relevant transform method used. See the Imagecow Documentation for more details.

ที่มา:https://github.com/kevbaldwyn/image/

วันพฤหัสบดีที่ 3 กันยายน พ.ศ. 2558

laravel 4.2 CMS (fullycms)



วิธีติดตั้ง
  1. เข้าไป download zip file จาก https://github.com/sseffa/fullycms/tree/laravel-4.2
  2. ใช้  command line open in the folder, run composer install
  3. Enter your database details into app/config/database.php
  4. Run php artisan app:install to setup and seed your database
  5. Default admin, email: admin@admin.com, password: admin
  6. Settings app/config/sfcms.php. (optional)
    • Cache enable / disable
    • image folder
    • post per page
    • ...
วิธีแก้ปัญหา
1.หา path ไม่เจอดังรูป
วิธีแก้ไข-> เปิดไฟล์ \public\filemanager\scripts\filemanager.config.js  แก้ไขในบรรทัด "fileRoot": "sf_cms/public/uploads/" ให้เป็น "fileRoot": "project-folder/public/uploads/",