Results: 1578
Notes
  • Newest first
  • Oldest first
  • Newest first(All)
  • Oldest first(All)
Shows all the routes that we have in our application
 php artisan route:list
by Valeri Tandilashvili
5 years ago
0
Laravel
routes
Laravel From Scratch
1
Shows count of posts
echo App\Post::count();
Creates new post in
posts
table using tinker from terminal
$post = new App\Post();
$post->title = 'the post title';
$post->content = 'the post body';
$post->save();
Deletes the newly created post
$post->delete();
by Valeri Tandilashvili
5 years ago
0
Laravel
tinker commands
Laravel From Scratch
0
Activates database eloquent mode in terminal
php artisan tinker
by Valeri Tandilashvili
5 years ago
0
Laravel
artisan commands
Laravel From Scratch
0
create table
Schema::create('posts', function (Blueprint $table) {
    $table->id();
    $table->string('title');
    $table->mediumText('content');
    $table->timestamps();
});
$table->id()
- creates
bigint(20)
unsigned auto-increment field
$table->string('title')
- creates
varchar(255)
utf8mb4_unicode_ci field
$table->mediumText('content')
- creates
mediumtext
utf8mb4_unicode_ci field
$table->timestamps()
- creates
created_at
and
updated_at
timestamps
by Valeri Tandilashvili
5 years ago
0
Laravel
migrations
1
.env
file contains database config information that needs to be changed to use the database
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=lara4db
DB_USERNAME=root
DB_PASSWORD=
by Valeri Tandilashvili
5 years ago
0
Laravel
Laravel From Scratch
1
Makes model called
Post
php artisan make:model Post
With the following basic content
<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Post extends Model
{
    //
}
Creates
Post
model and also migrations to create table for the model
php artisan make:model Post -m
The migration file location is
database/migrations/2020_09_02_041219_create_posts_table.php
by Valeri Tandilashvili
5 years ago
0
Laravel
artisan commands
Laravel From Scratch
1
Makes controller for
Posts
php artisan make:controller PostsController
With the following basic content
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class Postscontroller extends Controller
{
    //
}
Creates controller and empty methods in it (with appropriate comments)
php artisan make:controller PostsController --resource
The methods are:
index()
- Displays a list of the resource.
create()
- Shows the form for creating a new resource
store(Request $request)
- Stores a newly created resource in storage
show($id)
- Displays the specified resource
edit($id)
- Shows the form for editing the specified resource
update(Request $request, $id)
- Updates the specified resource in storage
destroy($id)
- Removes the specified resource from storage
by Valeri Tandilashvili
5 years ago
0
Laravel
artisan commands
Laravel From Scratch
1
php artisan serve
Creates local server to serve the Laravel application (must be run in the root folder of the project)
php artisan serve
by Valeri Tandilashvili
5 years ago
0
Laravel
artisan commands
0
npm run watch
Waits for changes and then recompiles again
npm run watch
by Valeri Tandilashvili
5 years ago
0
Laravel
npm commands
0
npm run dev
Compiles assets
npm run dev
by Valeri Tandilashvili
5 years ago
0
Laravel
npm commands
0
Results: 1578