Posted by Arjun on Sunday 16th February 2014

How to Create Laravel Eloquent model without a primary key ?

This post about Creating Laravel Eloquent model without a primary key,By default laravel will take primary key as ID, we can override this by protected $primaryKey = 'something';, but in order to turn of this we need to set it as shown below

    /**
     * primaryKey 
     * 
     * @var integer
     * @access protected
     */
    protected $primaryKey = null;

    /**
     * Indicates if the IDs are auto-incrementing.
     *
     * @var bool
     */
    public $incrementing = false;

That’s pretty much it. Leave a comment below if you have questions leave a comment