Created
April 27, 2021 07:49
-
-
Save edward1986/37a41f66078eaf0672336874617852d7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Illuminate\Database\Migrations\Migration; | |
use Illuminate\Database\Schema\Blueprint; | |
use Illuminate\Support\Facades\Schema; | |
class CreateUsersTable extends Migration | |
{ | |
/** | |
* Run the migrations. | |
* | |
* @return void | |
*/ | |
public function up() | |
{ | |
Schema::create('users', function (Blueprint $table) { | |
$table->id(); | |
$table->string('name'); | |
$table->string('email')->unique(); | |
$table->timestamp('email_verified_at')->nullable(); | |
$table->string('password'); | |
$table->rememberToken(); | |
$table->timestamps(); | |
}); | |
} | |
/** | |
* Reverse the migrations. | |
* | |
* @return void | |
*/ | |
public function down() | |
{ | |
Schema::dropIfExists('users'); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Illuminate\Database\Migrations\Migration; | |
use Illuminate\Database\Schema\Blueprint; | |
use Illuminate\Support\Facades\Schema; | |
class CreatePasswordResetsTable extends Migration | |
{ | |
/** | |
* Run the migrations. | |
* | |
* @return void | |
*/ | |
public function up() | |
{ | |
Schema::create('password_resets', function (Blueprint $table) { | |
$table->string('email')->index(); | |
$table->string('token'); | |
$table->timestamp('created_at')->nullable(); | |
}); | |
} | |
/** | |
* Reverse the migrations. | |
* | |
* @return void | |
*/ | |
public function down() | |
{ | |
Schema::dropIfExists('password_resets'); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Illuminate\Database\Migrations\Migration; | |
use Illuminate\Database\Schema\Blueprint; | |
use Illuminate\Support\Facades\Schema; | |
class CreateFailedJobsTable extends Migration | |
{ | |
/** | |
* Run the migrations. | |
* | |
* @return void | |
*/ | |
public function up() | |
{ | |
Schema::create('failed_jobs', function (Blueprint $table) { | |
$table->id(); | |
$table->string('uuid')->unique(); | |
$table->text('connection'); | |
$table->text('queue'); | |
$table->longText('payload'); | |
$table->longText('exception'); | |
$table->timestamp('failed_at')->useCurrent(); | |
}); | |
} | |
/** | |
* Reverse the migrations. | |
* | |
* @return void | |
*/ | |
public function down() | |
{ | |
Schema::dropIfExists('failed_jobs'); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Illuminate\Database\Migrations\Migration; | |
use Illuminate\Database\Schema\Blueprint; | |
use Illuminate\Support\Facades\Schema; | |
class CreateCategoriesTable extends Migration | |
{ | |
/** | |
* Run the migrations. | |
* | |
* @return void | |
*/ | |
public function up() | |
{ | |
Schema::create('categories', function (Blueprint $table) { | |
$table->id(); | |
$table->string('name', 60)->unique(); | |
$table->string('icon'); | |
$table->integer('user_id'); | |
$table->timestamps(); | |
}); | |
} | |
/** | |
* Reverse the migrations. | |
* | |
* @return void | |
*/ | |
public function down() | |
{ | |
Schema::dropIfExists('categories'); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Illuminate\Database\Migrations\Migration; | |
use Illuminate\Database\Schema\Blueprint; | |
use Illuminate\Support\Facades\Schema; | |
class CreateOrdersTable extends Migration | |
{ | |
/** | |
* Run the migrations. | |
* | |
* @return void | |
*/ | |
public function up() | |
{ | |
Schema::create('orders', function (Blueprint $table) { | |
$table->id(); | |
$table->string('order_date'); | |
$table->integer('user_id'); | |
$table->timestamps(); | |
}); | |
} | |
/** | |
* Reverse the migrations. | |
* | |
* @return void | |
*/ | |
public function down() | |
{ | |
Schema::dropIfExists('orders'); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Illuminate\Database\Migrations\Migration; | |
use Illuminate\Database\Schema\Blueprint; | |
use Illuminate\Support\Facades\Schema; | |
class CreateProductsTable extends Migration | |
{ | |
/** | |
* Run the migrations. | |
* | |
* @return void | |
*/ | |
public function up() | |
{ | |
Schema::create('products', function (Blueprint $table) { | |
$table->id(); | |
$table->string('name'); | |
$table->double('price'); | |
$table->string('photo'); | |
$table->double('discount'); | |
$table->boolean('is_hot_product'); | |
$table->boolean('is_new_arrival'); | |
$table->integer('category_id'); | |
$table->integer('user_id'); | |
$table->string('detail')->nullable(); | |
$table->timestamps(); | |
}); | |
Schema::table('orders', function (Blueprint $table) { | |
$table->integer('product_id'); | |
}); | |
} | |
/** | |
* Reverse the migrations. | |
* | |
* @return void | |
*/ | |
public function down() | |
{ | |
Schema::dropIfExists('products'); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Illuminate\Database\Migrations\Migration; | |
use Illuminate\Database\Schema\Blueprint; | |
use Illuminate\Support\Facades\Schema; | |
class CreateShippingsTable extends Migration | |
{ | |
/** | |
* Run the migrations. | |
* | |
* @return void | |
*/ | |
public function up() | |
{ | |
Schema::create('shippings', function (Blueprint $table) { | |
$table->id(); | |
$table->string('name'); | |
$table->string('email'); | |
$table->string('address'); | |
$table->timestamps(); | |
}); | |
} | |
/** | |
* Reverse the migrations. | |
* | |
* @return void | |
*/ | |
public function down() | |
{ | |
Schema::dropIfExists('shippings'); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Illuminate\Database\Migrations\Migration; | |
use Illuminate\Database\Schema\Blueprint; | |
use Illuminate\Support\Facades\Schema; | |
class CreateSlidersTable extends Migration | |
{ | |
/** | |
* Run the migrations. | |
* | |
* @return void | |
*/ | |
public function up() | |
{ | |
Schema::create('sliders', function (Blueprint $table) { | |
$table->id(); | |
$table->string('title'); | |
$table->string('message'); | |
$table->string('image_url'); | |
$table->timestamps(); | |
}); | |
} | |
/** | |
* Reverse the migrations. | |
* | |
* @return void | |
*/ | |
public function down() | |
{ | |
Schema::dropIfExists('sliders'); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Models; | |
use Illuminate\Database\Eloquent\Factories\HasFactory; | |
use Illuminate\Database\Eloquent\Model; | |
class Category extends Model | |
{ | |
use HasFactory; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Controllers\Api; | |
use App\Http\Controllers\Controller; | |
use App\Http\Resources\CategoryResource; | |
use App\Models\Category; | |
use Illuminate\Http\Request; | |
class CategoryController extends Controller | |
{ | |
/** | |
* Display a listing of the resource. | |
* | |
* @return \Illuminate\Http\Response | |
*/ | |
public function index() | |
{ | |
return CategoryResource::collection(Category::all()); | |
} | |
/** | |
* 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 int $id | |
* @return \Illuminate\Http\Response | |
*/ | |
public function show($id) | |
{ | |
// | |
} | |
/** | |
* Update the specified resource in storage. | |
* | |
* @param \Illuminate\Http\Request $request | |
* @param int $id | |
* @return \Illuminate\Http\Response | |
*/ | |
public function update(Request $request, $id) | |
{ | |
// | |
} | |
/** | |
* Remove the specified resource from storage. | |
* | |
* @param int $id | |
* @return \Illuminate\Http\Response | |
*/ | |
public function destroy($id) | |
{ | |
// | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Resources; | |
use Illuminate\Http\Resources\Json\JsonResource; | |
class CategoryResource extends JsonResource | |
{ | |
/** | |
* Transform the resource into an array. | |
* | |
* @param \Illuminate\Http\Request $request | |
* @return array | |
*/ | |
public function toArray($request) | |
{ | |
return | |
[ | |
'id' => $this->id, | |
'categoryName' => $this->name, | |
'categoryIcon' => $this->icon | |
]; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Models; | |
use Illuminate\Database\Eloquent\Factories\HasFactory; | |
use Illuminate\Database\Eloquent\Model; | |
class Order extends Model | |
{ | |
use HasFactory; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Controllers\Api; | |
use App\Http\Controllers\Controller; | |
use App\Http\Resources\OrderResource; | |
use App\Models\Order; | |
use Illuminate\Http\Request; | |
class OrderController extends Controller | |
{ | |
/** | |
* Display a listing of the resource. | |
* | |
* @return \Illuminate\Http\Response | |
*/ | |
public function index() | |
{ | |
return OrderResource::collection(Order::all()); | |
} | |
/** | |
* 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\Order $order | |
* @return \Illuminate\Http\Response | |
*/ | |
public function show(Order $order) | |
{ | |
// | |
} | |
/** | |
* Update the specified resource in storage. | |
* | |
* @param \Illuminate\Http\Request $request | |
* @param \App\Models\Order $order | |
* @return \Illuminate\Http\Response | |
*/ | |
public function update(Request $request, Order $order) | |
{ | |
// | |
} | |
/** | |
* Remove the specified resource from storage. | |
* | |
* @param \App\Models\Order $order | |
* @return \Illuminate\Http\Response | |
*/ | |
public function destroy(Order $order) | |
{ | |
// | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Resources; | |
use Illuminate\Http\Resources\Json\JsonResource; | |
class OrderResource extends JsonResource | |
{ | |
/** | |
* Transform the resource into an array. | |
* | |
* @param \Illuminate\Http\Request $request | |
* @return array | |
*/ | |
public function toArray($request) | |
{ | |
return parent::toArray($request); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Controllers\Api; | |
use App\Http\Controllers\Controller; | |
use App\Models\Order; | |
use Carbon\Carbon; | |
use Illuminate\Http\Request; | |
class PaymentController extends Controller | |
{ | |
public function makePayment(Request $request) | |
{ | |
try{ | |
$data = $request->input('cartItems'); | |
$cartItems = json_decode($data, true); | |
$totalAmount = 0.0; | |
foreach ($cartItems as $cartItem){ | |
$order = new Order(); | |
$order->order_date = Carbon::now()->toDateString(); | |
$order->product_id = $cartItem['productId']; | |
$order->user_id = $request->input('userId'); | |
$order->quantity = $cartItem['productQuantity']; | |
$order->amount = ($cartItem['productPrice'] - $cartItem['productDiscount']); | |
$totalAmount+= $order->amount * $order->quantity; | |
$order->save(); | |
} | |
\Stripe\Stripe::setApiKey('sk_test_xqiuBaqJHd9Gl5dmHmYd00Yb00KwGm5pGt'); | |
$token = \Stripe\Token::create([ | |
'card' => [ | |
'number' => $request->input('cardNumber'), | |
'exp_month' => $request->input('expiryMonth'), | |
'exp_year' => $request->input('expiryYear'), | |
'cvc' => $request->input('cvcNumber') | |
] | |
]); | |
$charge = \Stripe\Charge::create([ | |
'amount' => $totalAmount * 100, | |
'currency' => 'usd', | |
'source' => $token, | |
'receipt_email' => $request->input('email'), | |
]); | |
return response(['result' => true]); | |
} catch (\Exception $exception){ | |
return response(['result' => $exception]); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Models; | |
use Illuminate\Database\Eloquent\Factories\HasFactory; | |
use Illuminate\Database\Eloquent\Model; | |
class Product extends Model | |
{ | |
use HasFactory; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Controllers\Api; | |
use App\Http\Controllers\Controller; | |
use App\Http\Resources\ProductResource; | |
use App\Models\Product; | |
use Illuminate\Http\Request; | |
class ProductController extends Controller | |
{ | |
public function getAllHotProducts(){ | |
$hotProducts = Product::where('is_hot_product', 1)->get(); | |
return ProductResource::collection($hotProducts); | |
} | |
public function getAllNewArrivalProducts(){ | |
$newArrivalProducts = Product::where('is_new_arrival', 1)->get(); | |
return ProductResource::collection($newArrivalProducts); | |
} | |
public function getProductsByCategoryId($categoryId){ | |
$productsByCategory = Product::where('category_id', $categoryId)->get(); | |
return ProductResource::collection($productsByCategory); | |
} | |
/** | |
* Display a listing of the resource. | |
* | |
* @return \Illuminate\Http\Response | |
*/ | |
public function index() | |
{ | |
// | |
} | |
/** | |
* 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\Product $product | |
* @return \Illuminate\Http\Response | |
*/ | |
public function show(Product $product) | |
{ | |
// | |
} | |
/** | |
* Update the specified resource in storage. | |
* | |
* @param \Illuminate\Http\Request $request | |
* @param \App\Models\Product $product | |
* @return \Illuminate\Http\Response | |
*/ | |
public function update(Request $request, Product $product) | |
{ | |
// | |
} | |
/** | |
* Remove the specified resource from storage. | |
* | |
* @param \App\Models\Product $product | |
* @return \Illuminate\Http\Response | |
*/ | |
public function destroy(Product $product) | |
{ | |
// | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Resources; | |
use Illuminate\Http\Resources\Json\JsonResource; | |
class ProductResource extends JsonResource | |
{ | |
/** | |
* Transform the resource into an array. | |
* | |
* @param \Illuminate\Http\Request $request | |
* @return array | |
*/ | |
public function toArray($request) | |
{ | |
return parent::toArray($request); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Models; | |
use Illuminate\Database\Eloquent\Factories\HasFactory; | |
use Illuminate\Database\Eloquent\Model; | |
class Shipping extends Model | |
{ | |
use HasFactory; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Controllers\Api; | |
use App\Http\Controllers\Controller; | |
use App\Models\Shipping; | |
use Illuminate\Http\Request; | |
use Illuminate\Support\Facades\Log; | |
class ShippingController extends Controller | |
{ | |
/** | |
* Display a listing of the resource. | |
* | |
* @return \Illuminate\Http\Response | |
*/ | |
public function index() | |
{ | |
// | |
} | |
/** | |
* Store a newly created resource in storage. | |
* | |
* @param \Illuminate\Http\Request $request | |
* @return \Illuminate\Http\Response | |
*/ | |
public function store(Request $request) | |
{ | |
$shipping = new Shipping(); | |
$shipping->name = $request->input('name'); | |
$shipping->email = $request->input('email'); | |
$shipping->address = $request->input('address'); | |
if($shipping->save()){ | |
return response(['result' => true]); | |
} | |
return response(['result' => false]); | |
} | |
/** | |
* Display the specified resource. | |
* | |
* @param \App\Models\Shipping $shipping | |
* @return \Illuminate\Http\Response | |
*/ | |
public function show(Shipping $shipping) | |
{ | |
// | |
} | |
/** | |
* Update the specified resource in storage. | |
* | |
* @param \Illuminate\Http\Request $request | |
* @param \App\Models\Shipping $shipping | |
* @return \Illuminate\Http\Response | |
*/ | |
public function update(Request $request, Shipping $shipping) | |
{ | |
// | |
} | |
/** | |
* Remove the specified resource from storage. | |
* | |
* @param \App\Models\Shipping $shipping | |
* @return \Illuminate\Http\Response | |
*/ | |
public function destroy(Shipping $shipping) | |
{ | |
// | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Models; | |
use Illuminate\Database\Eloquent\Factories\HasFactory; | |
use Illuminate\Database\Eloquent\Model; | |
class Slider extends Model | |
{ | |
use HasFactory; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Controllers\Api; | |
use App\Http\Controllers\Controller; | |
use App\Http\Resources\SliderResource; | |
use App\Models\Slider; | |
use Illuminate\Http\Request; | |
class SliderController extends Controller | |
{ | |
/** | |
* Display a listing of the resource. | |
* | |
* @return \Illuminate\Http\Response | |
*/ | |
public function index() | |
{ | |
return SliderResource::collection(Slider::all()); | |
} | |
/** | |
* 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\Slider $slider | |
* @return \Illuminate\Http\Response | |
*/ | |
public function show(Slider $slider) | |
{ | |
// | |
} | |
/** | |
* Update the specified resource in storage. | |
* | |
* @param \Illuminate\Http\Request $request | |
* @param \App\Models\Slider $slider | |
* @return \Illuminate\Http\Response | |
*/ | |
public function update(Request $request, Slider $slider) | |
{ | |
// | |
} | |
/** | |
* Remove the specified resource from storage. | |
* | |
* @param \App\Models\Slider $slider | |
* @return \Illuminate\Http\Response | |
*/ | |
public function destroy(Slider $slider) | |
{ | |
// | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Resources; | |
use Illuminate\Http\Resources\Json\JsonResource; | |
class SliderResource extends JsonResource | |
{ | |
/** | |
* Transform the resource into an array. | |
* | |
* @param \Illuminate\Http\Request $request | |
* @return array | |
*/ | |
public function toArray($request) | |
{ | |
return parent::toArray($request); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Models; | |
use Illuminate\Contracts\Auth\MustVerifyEmail; | |
use Illuminate\Database\Eloquent\Factories\HasFactory; | |
use Illuminate\Foundation\Auth\User as Authenticatable; | |
use Illuminate\Notifications\Notifiable; | |
class User extends Authenticatable | |
{ | |
use HasFactory, Notifiable; | |
/** | |
* The attributes that are mass assignable. | |
* | |
* @var array | |
*/ | |
protected $fillable = [ | |
'name', | |
'email', | |
'password', | |
]; | |
/** | |
* The attributes that should be hidden for arrays. | |
* | |
* @var array | |
*/ | |
protected $hidden = [ | |
'password', | |
'remember_token', | |
]; | |
/** | |
* The attributes that should be cast to native types. | |
* | |
* @var array | |
*/ | |
protected $casts = [ | |
'email_verified_at' => 'datetime', | |
]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Controllers\Api; | |
use App\Http\Controllers\Controller; | |
use App\Models\User; | |
use Illuminate\Http\Request; | |
use Illuminate\Support\Facades\Hash; | |
use Illuminate\Support\Facades\Auth; | |
class UserController extends Controller | |
{ | |
public function register(Request $request) | |
{ | |
$user = new User(); | |
$user->name = $request->input('name'); | |
$user->email = $request->input('email'); | |
$user->password = Hash::make($request->input('password')); | |
if($user->save()){ | |
if (Auth::attempt(['email' => $request->input('email'), 'password' => $request->input('password')])) { | |
return response(['result' => true, 'user' => Auth::user()]); | |
} | |
} | |
return response(['result' => false, 'user' => new User()]); | |
} | |
public function login(Request $request) | |
{ | |
if(Auth::attempt(['email' => $request->input('email'), 'password' => $request->input('password')])){ | |
return response(['result' => true, 'user' => Auth::user()]); | |
} | |
return response(['result' => false, 'user' => new User()]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment