add shipping rules
This commit is contained in:
@@ -7,12 +7,14 @@ class Basket
|
||||
public static function first($key)
|
||||
{
|
||||
$data = self::get($key);
|
||||
|
||||
return array_shift($data);
|
||||
}
|
||||
|
||||
public static function last($key)
|
||||
{
|
||||
$data = self::get($key);
|
||||
|
||||
return $data ? array_pop($data) : false;
|
||||
}
|
||||
|
||||
@@ -33,6 +35,7 @@ class Basket
|
||||
array_push($data, $value);
|
||||
self::set($key, $data);
|
||||
}
|
||||
|
||||
return count($data);
|
||||
}
|
||||
|
||||
@@ -42,6 +45,7 @@ class Basket
|
||||
if (($index = array_search($value, $data)) !== false) {
|
||||
unset($data[$index]);
|
||||
}
|
||||
|
||||
return self::set($key, $data);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,8 +13,7 @@ class NewUser extends Notification
|
||||
/**
|
||||
* Get the notification's delivery channels.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @return string[]
|
||||
*/
|
||||
public function via($notifiable)
|
||||
@@ -25,8 +24,7 @@ class NewUser extends Notification
|
||||
/**
|
||||
* Get the mail representation of the notification.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @return \Illuminate\Notifications\Messages\MailMessage
|
||||
*/
|
||||
public function toMail($notifiable)
|
||||
@@ -40,7 +38,7 @@ class NewUser extends Notification
|
||||
->line(
|
||||
__(
|
||||
'notifications.newuser.intro', [
|
||||
'name' => $currentUser->first_name.' '.$currentUser->last_name,
|
||||
'name' => $currentUser->first_name.' '.$currentUser->last_name,
|
||||
]
|
||||
)
|
||||
)
|
||||
@@ -51,7 +49,7 @@ class NewUser extends Notification
|
||||
->salutation(
|
||||
__(
|
||||
'notifications.salutation', [
|
||||
'name' => $currentUser->first_name.' '.$currentUser->last_name,
|
||||
'name' => $currentUser->first_name.' '.$currentUser->last_name,
|
||||
]
|
||||
)
|
||||
)
|
||||
@@ -61,8 +59,7 @@ class NewUser extends Notification
|
||||
/**
|
||||
* Get the array representation of the notification.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($notifiable)
|
||||
|
||||
@@ -9,8 +9,7 @@ class ResetPassword extends \Illuminate\Auth\Notifications\ResetPassword
|
||||
/**
|
||||
* Get the mail representation of the notification.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @return \Illuminate\Notifications\Messages\MailMessage
|
||||
*/
|
||||
/*
|
||||
|
||||
@@ -2,9 +2,7 @@
|
||||
|
||||
namespace App\Repositories\Core\User;
|
||||
|
||||
use App\Repositories\Core\Auth\Users;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use \Cart;
|
||||
use Cart;
|
||||
|
||||
class ShopCart
|
||||
{
|
||||
@@ -20,6 +18,7 @@ class ShopCart
|
||||
} else {
|
||||
self::get()->add($item);
|
||||
}
|
||||
|
||||
return [
|
||||
'count' => self::count(),
|
||||
'quantity' => self::getTotalQuantity(),
|
||||
@@ -45,6 +44,7 @@ class ShopCart
|
||||
public static function clear()
|
||||
{
|
||||
Cart::clear();
|
||||
|
||||
return self::get()->clear();
|
||||
}
|
||||
|
||||
|
||||
@@ -2,10 +2,8 @@
|
||||
|
||||
namespace App\Repositories\Core\User;
|
||||
|
||||
use Darryldecode\Cart\CartCollection;
|
||||
|
||||
use App\Models\Core\CartStorage;
|
||||
use App\Repositories\Core\Auth\Users;
|
||||
use Darryldecode\Cart\CartCollection;
|
||||
|
||||
class ShopCartStorage
|
||||
{
|
||||
@@ -16,11 +14,12 @@ class ShopCartStorage
|
||||
|
||||
public function get($key)
|
||||
{
|
||||
if (!$this->has($key)) {
|
||||
if (! $this->has($key)) {
|
||||
return [];
|
||||
}
|
||||
return new CartCollection(CartStorage::find($key)->cart_data);
|
||||
|
||||
|
||||
return new CartCollection(CartStorage::find($key)->cart_data);
|
||||
|
||||
}
|
||||
|
||||
public function put($key, $value)
|
||||
@@ -31,7 +30,7 @@ class ShopCartStorage
|
||||
} else {
|
||||
CartStorage::create([
|
||||
'id' => $key,
|
||||
'cart_data' => $value
|
||||
'cart_data' => $value,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user