コード例 #1
0
ファイル: CategoryController.php プロジェクト: sordev/bootup
 private function getCategoryTypeOptions()
 {
     $return = [];
     $categoryTypes = CategoryType::select('id', 'title')->get();
     foreach ($categoryTypes as $ct) {
         $return[$ct->id] = $ct->title;
     }
     return $return;
 }
コード例 #2
0
 /**
  * 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();
 }
コード例 #3
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $types = CategoryType::all();
     return Response::json($types, 200);
 }
コード例 #4
0
ファイル: Category.php プロジェクト: sordev/bootup
 public function getTypeslugAttribute()
 {
     return CategoryType::find($this->type)->slug;
 }