Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as:
- Simple, fast routing engine.
- Powerful dependency injection container.
- Multiple back-ends for session and cache storage.
- Expressive, intuitive database ORM.
- Database agnostic schema migrations.
- Robust background job processing.
- Real-time event broadcasting.
Laravel is accessible, yet powerful, providing tools needed for large, robust applications.
Laravel has the most extensive and thorough documentation and video tutorial library of any modern web application framework, making it a breeze to get started learning the framework.
If you're not in the mood to read, Laracasts contains over 1100 video tutorials on a range of topics including Laravel, modern PHP, unit testing, JavaScript, and more. Boost the skill level of yourself and your entire team by digging into our comprehensive video library.
npm install
copy file .env.example, paste and rename it to .env
Database setting
use phpmyadmin to create the database name webhaji. After creating the database, we need to open the .env file inside Laravel project and add the database credentials like bellow with your setting.
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=webhaji
DB_USERNAME=root
DB_PASSWORD=
if your phpmyadmin have password "toor".
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=webhaji
DB_USERNAME=root
DB_PASSWORD=toor
Setting encryption by typing on project terminal/cmd
php artisan key:generate
make table from migration folder
php artisan migrate
insert dummy data from factory and seeder
php artisan db:seed
setting email on .env
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=yourGmailEmail
MAIL_PASSWORD=yourAppPasswordGeneratedFromGmail
MAIL_ENCRYPTION=tls
clear cache after edit env
php artisan config:cache
when stuck or application not update
composer dump-autoload
##Running Laravel
php artisan serve
updating the database(when needed)
php artisan migrate
creating symlink
php artisan storage:link
- create model with migration
php artisan make:model Yourmodelname --migration
-
check folder database/migration/your_model_name and open it
-
edit the migration file with column that will be on your model tabel check this link. example on file with same migrations folder
-
update the migration table on phpmyadmin
php artisan migrate
-
check folder app/YourModelname and open it
-
open file and edit the $fillable options (with your edited step number 3, column name can fill in the form), check Category.php for example
( optional ) if the model/migration has one to one / one to many / many to many on the migrations file.
check eloquent relation table on this link.
example many to many 2 tabel
- make new migration file for relating 2 tabel ex: category and post
php artisan make:migration create_category_post_table --create=category_post
-
edit the migrations file ex: on folder database/migrations/file_category_post_tabel
-
edit the app/Post.php see the file
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
//add this import use
use App\Category;
class Post extends Model
{
//add this method
public function categories()
{
return $this->belongsToMany(Category::class);
}
}
- edit the app/Category.php see the file
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
//add this import use
use App\Post;
class Category extends Model
{
//add this method
public function posts()
{
return $this->belongsToMany(Post::class);
}
}
5.done
( optional ) if the model/migration has one to one / one to many / many to many on the migrations file.
check eloquent relation table on this link.
example one to many 2 tabel ex: user and post
-
add the user id to database/migration/create_posts_tabel (see the file)
-
edit app/User.php see the file
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class User extends Model
{
//add this method
public function posts()
{
return $this->hasMany('App\Post');
}
}
- edit app/Post.php see the file
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Post extends Model
{
//add this method
public function users()
{
return $this->belongsTo('App\User');
}
}
create controller
php artisan make:controller NameController --resource
check all url from routes/web.php
php artisan route:list
edit the controller, example on folder app/Http/Controller/PostController.php
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the Laravel documentation.
The Laravel framework is open-sourced software licensed under the MIT license.