- add deal category migration - add deals migration and model - add form to create deal - add image preview modal when uploading the image - refactor UI components to support `required` attribute - refactor input component to support description - fix some UI components does not support old values - fix some UI components does not show error messages
79 lines
1.5 KiB
PHP
79 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Http\Requests\StoreBrokerDeal;
|
|
use App\Models\Deal;
|
|
use App\Models\DealCategory;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Str;
|
|
use const http\Client\Curl\AUTH_ANY;
|
|
|
|
class BrokerDealController extends Controller
|
|
{
|
|
/**
|
|
* Display a listing of the resource.
|
|
*/
|
|
public function index()
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Show the form for creating a new resource.
|
|
*/
|
|
public function create()
|
|
{
|
|
return view('dashboards.broker.deals.create')
|
|
->with('categories', DealCategory::all('id', 'name'));
|
|
}
|
|
|
|
/**
|
|
* Store a newly created resource in storage.
|
|
*/
|
|
public function store(StoreBrokerDeal $request)
|
|
{
|
|
$data = $request->validated();
|
|
$data['slug'] = Str::slug($data['title']);
|
|
$data['user_id'] = $request->user()->id;
|
|
|
|
Deal::unguard();
|
|
Deal::create($data);
|
|
Deal::reguard();
|
|
|
|
return to_route('broker.dashboard')->with('success', 'Deal has been created.');
|
|
}
|
|
|
|
/**
|
|
* Display the specified resource.
|
|
*/
|
|
public function show(string $id)
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Show the form for editing the specified resource.
|
|
*/
|
|
public function edit(string $id)
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Update the specified resource in storage.
|
|
*/
|
|
public function update(Request $request, string $id)
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Remove the specified resource from storage.
|
|
*/
|
|
public function destroy(string $id)
|
|
{
|
|
//
|
|
}
|
|
}
|