change registration or connection in order page, change filter on shelve page, add new api to get article_nature by product_type, css fixes

This commit is contained in:
Ludovic CANDELLIER
2023-02-10 23:11:48 +01:00
parent 405effe43e
commit cafd0a49e7
14 changed files with 74 additions and 24 deletions

View File

@@ -101,5 +101,4 @@ class ArticleController extends Controller
$data = Articles::toggleHomepage($request->input('id'), ($request->input('homepage') == 'true') ? 1 : 0);
return response()->json(['error' => 0]);
}
}

View File

@@ -41,4 +41,9 @@ class ArticleNatureController extends Controller
{
return ArticleNatures::destroy($id);
}
public static function getOptions($product_type)
{
return response()->json(['0' => ''] + ArticleNatures::getOptionsByProductType($product_type));
}
}

View File

@@ -9,8 +9,6 @@ use App\Repositories\Shop\Producers;
use App\Repositories\Shop\TagGroups;
use App\Datatables\Shop\MerchandisesDataTable;
use App\Models\Shop\Merchandise;
class MerchandiseController extends Controller
{
public function index(MerchandisesDataTable $dataTable)

View File

@@ -24,4 +24,19 @@ class ArticleNature extends Model
{
return $query->where($this->table . '.id', $id);
}
public function scopeByBotanic($query);
{
return $query->where($this->table . '.product_type', 1);
}
public function scopeByMerchandise($query);
{
return $query->where($this->table . '.product_type', 2);
}
public function scopeByProductType($query, $type)
{
return $query->where($this->table . '.product_type', $type);
}
}

View File

@@ -11,6 +11,21 @@ class ArticleNatures
return ArticleNature::get()->pluck('name', 'id')->toArray();
}
public static function getOptionsByMerchandise()
{
return self::getOptionsByProductType(2);
}
public static function getOptionsByBotanic()
{
return self::getOptionsByProductType(1);
}
public static function getOptionsByProductType($type)
{
return ArticleNature::byProductType($type)->get()->pluck('name', 'id')->toArray();
}
public static function getAll()
{
return ArticleNature::orderBy('name', 'asc')->get();