private function getCategoryTypeOptions() { $return = []; $categoryTypes = CategoryType::select('id', 'title')->get(); foreach ($categoryTypes as $ct) { $return[$ct->id] = $ct->title; } return $return; }
/** * Run the database seeds. * * @return void */ public function run() { Model::unguard(); User::create(array('name' => 'George Broadley', 'email' => '*****@*****.**', 'password' => Hash::make('password'))); CategoryType::create(array('name' => 'Bookmarks', 'table_name' => 'bookmarks')); CategoryType::create(array('name' => 'Checklists', 'table_name' => 'checklists')); CategoryType::create(array('name' => 'Notes', 'table_name' => 'notes')); CategoryType::create(array('name' => 'Reminders', 'table_name' => 'reminders')); Model::reguard(); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $types = CategoryType::all(); return Response::json($types, 200); }
public function getTypeslugAttribute() { return CategoryType::find($this->type)->slug; }