TEAM AWESOME LEARNING RESOURCES
1 - Project Management
2 - Laravel Database Management
3 - Laravel APIs
4 - Postman
1. Project Management
- Jira project management introduction
2. Laravel Database Management
- Create migrations
[Link]
Note: Always add
● $table->timestamps() - The timestamps method creates created_at and updated_at
TIMESTAMP equivalent columns with an optional fractional seconds precision:
● $table->softDeletes()
Note: Most of all primary keys use
● unsigned big integer for users
Note: Check each field
● Default values
● Nullable
Note: Check table
● CreatedBy
● Status
● Type
- Create relationship
Creating Table
Schema::create('user_entities', function (Blueprint $table) {
$table->id();
$table->string('is_owner', 45);
$table->string('position', 45);
$table->unsignedBigInteger('user_id');
$table->timestamps();
$table->softDeletes();
$table->foreign('user_id')
->references('id')
->on('users')
->onDelete('cascade')
->onUpdate('cascade');
});
Existing Table
Schema::table('users', function (Blueprint $table) {
$table->foreignId('city_id')
->nullable()
->references('id')
->on('cities')
->onDelete('no action')
->onUpdate('no action');
});
Dropping Foreign Keys
Schema::table('user_locations', function (Blueprint $table) {
$table->dropForeign("user_locations_city_id_foreign");
});
Examine: user_locations_city_id_foreign
user_locations = table
city_id = field
foreign = constant
- Create database seed
[Link]
3. Laravel APIs
- Create CRUD API endpoints
- Set Routes
[Link]
- Create Laravel Model and Controller
[Link]
php artisan make:model Flight -c
This creates model and controller
- Controller Functions
public function index(Request $request): JSONResponse
List of records
public function store(Request $request): JSONResponse
Save record
public function update(Request $request,int $entityId): JSONResponse
Update record
public function show($entityId): JSONResponse
Get record
public function destroy($entityId)
Delete record
- Create Laravel Services
- Laravel Validator
[Link]
4. Postman
- Postman Environments
- Postman User
Video Contents
Guide
1. Open database design image
2. Create migration file
3. Update fields
4. Update relationships
5. Create database seed if there are constant data
6. Create model and controller
7. In model file set relationships belongsTo
8. Create service file and inject the service file in the controller
9. In service file define the insert, update, delete, get and list methods
10. In controller create the index(), show(), delete(), update() and store()
11. Test in postman