mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/izyim-api.git
synced 2026-08-19 04:24:01 +00:00
added migration, model, and controller
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class DeliveryInfo extends Model
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class DeliveryInfoController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
return Product::all();
|
||||
}
|
||||
|
||||
public function show(DeliveryInfo $deliveryinfo)
|
||||
{
|
||||
return $deliveryinfo;
|
||||
}
|
||||
|
||||
public function store(DeliveryInfo $deliveryinfo)
|
||||
{
|
||||
$deliveryinfo = DeliveryInfot::create($request->all());
|
||||
|
||||
return response()->json(DeliveryInfo, 201);
|
||||
}
|
||||
|
||||
public function delete(DeliveryInfo $deliveryinfo)
|
||||
{
|
||||
$deliveryinfo->delete();
|
||||
|
||||
return response()->json(null, 204);
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
@@ -13,7 +14,7 @@ class AppServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
//
|
||||
Schema::defaultStringLength(191);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateDeliveryInfosTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('delivery_infos', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('branch');
|
||||
$table->string('deli_info');
|
||||
$table->string('address');
|
||||
$table->string('city');
|
||||
$table->integer('postcode');
|
||||
$table->string('state');
|
||||
$table->string('country');
|
||||
$table->string('contact_person');
|
||||
$table->integer('contact_person_no');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('delivery_infos');
|
||||
}
|
||||
}
|
||||
@@ -16,3 +16,11 @@ use Illuminate\Http\Request;
|
||||
Route::middleware('auth:api')->get('/user', function (Request $request) {
|
||||
return $request->user();
|
||||
});
|
||||
|
||||
Route::get('/api/company/del-info','DeliveryInfo@show');
|
||||
|
||||
|
||||
Route::post('/api/company/{com-id}/del-info', 'DeliveryInfo@store');
|
||||
|
||||
|
||||
Route::delete('/api/company/{com-id}/del-info', 'DeliveryInfo@delete');
|
||||
|
||||
@@ -14,3 +14,6 @@
|
||||
Route::get('/', function () {
|
||||
return view('welcome');
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user