Skip to content

Latest commit

 

History

History
58 lines (48 loc) · 1.88 KB

File metadata and controls

58 lines (48 loc) · 1.88 KB

Terminal commands

Categories - Model and migrations

  • php artisan make:model Category -m (make the model and migration for category table)
  • php artisan migrate (do the migration to the database, create the database if it doesn't exist)
  • php artisan tinker -> Category::create(['name => 'First']); (Add a category named first to our Category table)
 = App\Models\Category {#3735
 name: "First",
 updated_at: "2023-02-20 14:12:56",
 created_at: "2023-02-20 14:12:56",
 id: 1,
 }

Transactions - Model and migrations

  • php artisan make:model Transaction -m (make the model and migration for Transaction table)

  • php artisan make:controller Api/TransactionController --resource --api --model=Transaction (Create the Transaction controller with 5 methods)

  • php artisan migrate (do the migration to the database)

  • php artisan make:resource TransactionResource (Make a resource to do dataWrapping on all methods of a controller)

  • php artisan make:request StoreTransactionRequest (Add validation with required fields)

User - authentication

  • php artisan tinker => User:create(['email' => 'admin@admin', 'password' => bcrypt('123456'), 'name' => 'Admin'])
    App\Models\User {#4684
      email: "admin@admin",
      #password: "$2y$10$i/ft1oHcCV/HYIqRWwx2LOD1353zDePZDHBeIc5JdvvdFzV3KiRwm",
      name: "Admin",
      updated_at: "2023-02-22 11:02:30",
      created_at: "2023-02-22 11:02:30",
      id: 1,
    }