Commit 687a021c authored by Mohammad Javad Ghasemy's avatar Mohammad Javad Ghasemy 🦈

init books

parent 51ef9e14
<?php
namespace App\Http\Controllers;
use App\Models\Books;
use Illuminate\Http\Request;
class BooksController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*
* @param \App\Models\Books $books
* @return \Illuminate\Http\Response
*/
public function show(Books $books)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param \App\Models\Books $books
* @return \Illuminate\Http\Response
*/
public function edit(Books $books)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Models\Books $books
* @return \Illuminate\Http\Response
*/
public function update(Request $request, Books $books)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param \App\Models\Books $books
* @return \Illuminate\Http\Response
*/
public function destroy(Books $books)
{
//
}
}
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Books extends Model
{
use HasFactory;
const CREATED_AT = 'creation_date';
const UPDATED_AT = 'last_update';
}
<?php
namespace Database\Factories;
use App\Models\Books;
use Illuminate\Database\Eloquent\Factories\Factory;
class BooksFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Books::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
//
];
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateBooksTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('books', function (Blueprint $table) {
$table->id();
$table->string("isbn", 100);
$table->string("name", 100);
$table->text("picture")->nullable();
$table->timestamps();
$table->charset = 'utf8mb4';
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('books');
}
}
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
class BooksSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
//
}
}
......@@ -23,3 +23,5 @@ Auth::routes();
Route::get('/dashboard', [App\Http\Controllers\DashboardController::class, 'index'])->name(
'dashboard'
);
Route::resource("book", App\Http\Controllers\BooksController::class);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment