检索数据在laravel中形成

时间:2016-03-12 17:04:51

标签: php mysql laravel laravel-5

我是laravel的新人。我熟悉CI和CakePHP,但在laravel中是新的。在互联网上阅读laravel后,我安装了laravel并从数据库中检索数据,但我不理解检索到的对象,这是什么。请帮我理解。

App\Models\Question Object
(
    [primaryKey:protected] => id
    [fillable:protected] => Array
        (
            [0] => name
            [1] => email
            [2] => password
        )

    [hidden:protected] => Array
        (
            [0] => password
            [1] => remember_token
        )

    [connection:protected] => 
    [table:protected] => 
    [perPage:protected] => 15
    [incrementing] => 1
    [timestamps] => 1
    [attributes:protected] => Array
        (
            [id] => 1
            [t_num] => aP5z78e
            [university] => 5
            [course] => 1
            [branch] => 0
            [subject] => 6
            [type] => 1
            [year] => 2007,2011
            [session] => 
            [question] => State and explain Thevenin's therom with example.
            [paper_code] => 
            [marks] => 
            [slug] => state-and-explain-thevenins-therom-with-example
            [additional_info] => 
            [option_1] => 
            [option_2] => 
            [option_3] => 
            [option_4] => 
            [answer] => 
            [status] => 1
            [user_id] => 1
            [created] => 1439622767
            [modified] => 1439622767
        )

    [original:protected] => Array
        (
            [id] => 1
            [t_num] => aP5z78e
            [university] => 5
            [course] => 1
            [branch] => 0
            [subject] => 6
            [type] => 1
            [year] => 2007,2011
            [session] => 
            [question] => State and explain 
            [paper_code] => 
            [marks] => 
            [slug] => state-and-explain
            [additional_info] => 
            [option_1] => 
            [option_2] => 
            [option_3] => 
            [option_4] => 
            [answer] => 
            [status] => 1
            [user_id] => 1
            [created] => 1439622767
            [modified] => 1439622767
        )

    [relations:protected] => Array
        (
        )

    [visible:protected] => Array
        (
        )

    [appends:protected] => Array
        (
        )

    [guarded:protected] => Array
        (
            [0] => *
        )

    [dates:protected] => Array
        (
        )

    [dateFormat:protected] => 
    [casts:protected] => Array
        (
        )

    [touches:protected] => Array
        (
        )

    [observables:protected] => Array
        (
        )

    [with:protected] => Array
        (
        )

    [morphClass:protected] => 
    [exists] => 1
    [wasRecentlyCreated] => 
)

与其他车型的关系后,它被绞死了。

1 个答案:

答案 0 :(得分:0)

返回vap rgb-d-t dataset。这是一个有大量有用帮助者的对象。您可以访问对象的任何部分或在控制器,模型或视图中迭代对象:

在控制器中:

$obj->id;

在视图中:

{{ $obj->name }}