├── README.md ├── resources └── views │ ├── news │ ├── show.blade.php │ ├── index.blade.php │ ├── create.blade.php │ └── edit.blade.php │ └── layouts │ └── master.blade.php ├── database ├── seeds │ └── NewsTableSeeder.php └── migrations │ └── 2016_08_26_114034_create_news_table.php └── app ├── Http └── routes.php ├── News.php └── Controllers └── NewsController.php /README.md: -------------------------------------------------------------------------------- 1 | Simple CRUD (Add, Edit, Delete, View) in Laravel 2 | ======== 3 | 4 | A simple and basic system to add, edit, delete and view using Laravel PHP Framework. 5 | 6 | Blog Article: [Laravel: Simple CRUD (Add, Edit, Delete, View)](http://blog.chapagain.com.np/laravel-simple-crud-add-edit-delete-view-beginner-tutorial/) 7 | -------------------------------------------------------------------------------- /resources/views/news/show.blade.php: -------------------------------------------------------------------------------- 1 | 2 | @extends('layouts.master') 3 | 4 | @section('title', $news->title) 5 | 6 | @section('sidebar') 7 | @parent 8 | // you can add something here 9 | @endsection 10 | 11 | @section('content') 12 |
{{ $news->full_content }}
17 | 18 | @endsection 19 | -------------------------------------------------------------------------------- /database/seeds/NewsTableSeeder.php: -------------------------------------------------------------------------------- 1 | insert([ 19 | 'title' => $faker->sentence(), 20 | 'slug' => $faker->slug, 21 | 'short_description' => $faker->paragraph(), 22 | 'full_content' => $faker->paragraphs(3, true), // 3 paragraphs 23 | 'author' => $faker->name, 24 | 'category' => $faker->colorName, // color name as category 25 | 'created_at' => $faker->dateTime(), 26 | 'updated_at' => $faker->dateTime(), 27 | ]); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /resources/views/layouts/master.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 |{{ $error }}
20 | @endforeach 21 |
17 | {{ $data->title }}
18 |
19 |
20 |
{{ $data->short_description }}
40 || {!! Form::label('title', 'Title', ['class' => 'control-label']) !!} | 22 |{!! Form::text('title', null, ['class' => 'form-control', 'size' => 64, ]) !!} | 23 |
| {!! Form::label('slug', 'Slug', ['class' => 'control-label']) !!} | 26 |{!! Form::text('slug', null, ['class' => 'form-control', 'size' => 64, ]) !!} | 27 |
| {!! Form::label('category', 'Category', ['class' => 'control-label']) !!} | 30 |{!! Form::select('category', array('Politics' => 'Politics', 'Sports' => 'Sports', 'International' => 'International'), null, ['placeholder' => 'Select Category']) !!} | 31 |
| {!! Form::label('author', 'Author', ['class' => 'control-label']) !!} | 34 |{!! Form::select('author', array('John' => 'John', 'Tom' => 'Tom', 'Jack' => 'Jack'), null, ['placeholder' => 'Select Author']) !!} | 35 |
| {!! Form::label('short_description', 'Short Description', ['class' => 'control-label']) !!} | 38 |{!! Form::textarea('short_description', null, ['class' => 'form-control']) !!} | 39 |
| {!! Form::label('full_content', 'Full Content', ['class' => 'control-label']) !!} | 42 |{!! Form::textarea('full_content', null, ['class' => 'form-control']) !!} | 43 |
| 46 | | {!! Form::submit('Submit', ['class' => 'btn btn-submit']) !!} | 47 |
| {!! Form::label('title', 'Title', ['class' => 'control-label']) !!} | 23 |{!! Form::text('title', null, ['class' => 'form-control', 'size' => 64, ]) !!} | 24 |
| {!! Form::label('slug', 'Slug', ['class' => 'control-label']) !!} | 27 |{!! Form::text('slug', null, ['class' => 'form-control', 'size' => 64, ]) !!} | 28 |
| {!! Form::label('category', 'Category', ['class' => 'control-label']) !!} | 31 |{!! Form::select('category', array('Politics' => 'Politics', 'Sports' => 'Sports', 'International' => 'International'), null, ['placeholder' => 'Select Category']) !!} | 32 |
| {!! Form::label('author', 'Author', ['class' => 'control-label']) !!} | 35 |{!! Form::select('author', array('John' => 'John', 'Tom' => 'Tom', 'Jack' => 'Jack'), null, ['placeholder' => 'Select Author']) !!} | 36 |
| {!! Form::label('short_description', 'Short Description', ['class' => 'control-label']) !!} | 39 |{!! Form::textarea('short_description', null, ['class' => 'form-control']) !!} | 40 |
| {!! Form::label('full_content', 'Full Content', ['class' => 'control-label']) !!} | 43 |{!! Form::textarea('full_content', null, ['class' => 'form-control']) !!} | 44 |
| 47 | | {!! Form::submit('Submit', ['class' => 'btn btn-submit']) !!} | 48 |