Laravel Study Note One

Source: Internet
Author: User
1. Create a new file

PHP Artisan generate:seed Page

Create a new app/database/seeds/pagetableseeder.php file.

PHP Artisan Generate:model Article

Create a new app/models/article.php file.

PHP Artisan Generate:view Admin._layouts.default

Create a new app/views/admin/_layouts/default.blade.php file.

2. Installing the composer component

Add the component name and version number in Composer.json require or Require-dev:

"Edvinaskrucas/notification": "3.0.1"

Execute the composer Update command at the root of the app

Add a line to App.php's providers:

' Krucas\notification\notificationserviceprovider ',

Add a line to App.php's aliases:

' Notification ' = ' krucas\notification\facades\notification ',

3. Tips for handling methods that the class cannot find

Composer Dump-autoload

4. After creating a new folder, add the path to a row of folders in the Composer.json autoload classmap to find the file.

5.

Sentry::check () Check if the user is logged in

Input::get (' email ') get the data obtained by the user Get method

Execute command PHP artisan serve, run Lavarel development server.

Redirect::route (' Admin.login ')

Redirect::to (' eadmin/products ')

Html::link (' Accounts/newaccount ', ' register ', Array (' class ' = ' default-btn '))

Form::open (Array (' url ' = ' accounts/signin '))

6. Eloqyent

Class Page extends \eloquent {

Use the users database by default

protected $table = ' myusers '; If the value of the Tabel property is specified, a table with table name is used.

The primary key for the default table is the ID

protected $primaryKey = ' IDs '; Change the primary key name by specifying Primarkey

Default Updated_at created_at fields per database

can set

protected $timestamps = false; Cancel the two fields

Protected $appends = Array ("", ""); Fields that need to be used but not in the database,

Protected $hidden = Array ("", ""); You need to hide the fields to restrict the property data that can appear in the array or JSON format

Use softdeletingtrait; The soft delete feature is turned on, and data is not deleted from the database when data is deleted using the model instance, and the value is to add a deleted_at timestamp.

protected function GetDateFormat () {return ' U ';}//Custom timestamp format can override this method

}

The above describes the Laravel study note one, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.