Amranidev\ScaffoldInterface\Attribute::getAttributes PHP Method

getAttributes() public method

Get attributes from an existing table.
public getAttributes ( ) : array
return array
    public function getAttributes()
    {
        //get table attributes
        $this->result = Schema::getColumnListing($this->table);
        //delete the first element, (ignore the id section)
        unset($this->result[0]);
        //get result
        return $this->result;
    }

Usage Example

 /**
  * Get attributes.
  *
  * @param string $table
  *
  * @return \Illuminate\Http\Response
  */
 public function getResult($table, Request $request)
 {
     $attributes = new Attribute($table);
     if ($request->ajax()) {
         return $attributes->getAttributes();
     }
 }