Laravel Edit removes uploaded file

I am creating a Laravel crud. in here i have a DB table called: File: ‘title’,’description_short’,’description_long,’file’,’language’ the problem lays in the ‘file’ column. here i can upload files like word and excel. but whenever i edit a row with a file attached. the file gets removed if i don’t upload A or THE file again.… Read More Laravel Edit removes uploaded file

Laravel get relation with another relation

SellerController.php public function products() { $seller = Auth::user(); $products = Seller::find($seller->id)->products; //return only products, I need to get category with this relation!!! return response()->json([‘data’ => $products], 200); } This return seller’s products. Seller.php public function products() { return $this->hasMany(‘App\Models\Products’, ‘user’); } Products.php function seller() { return $this->belongsTo(‘App\Models\Seller’, ‘user’); } function Category() { return $this->hasOne(‘App\Models\Category’,’cat’); }… Read More Laravel get relation with another relation

How replacewith table row by jquery

i have already a table <tbody class="sellbook"> <tr class="foobar-26"> <td>price</td> <td>amount</td> <td>total</td> </tr> <tr class="foobar-27"> <td>price</td> <td>amount</td> <td>total</td> </tr> <tr class="foobar-28"> <td>price</td> <td>amount</td> <td>total</td> </tr> </tbody> need to be replace all table rows with new updated data, example as follow data message: Array(11) [ {…}, {…}, {…}, … ] ​​ 0: Object { id: 97,… Read More How replacewith table row by jquery

I need to make auth on all resource controller except show class

I need to make auth on all resource controller except show class Route::get(‘/’, function () { return view(‘welcome’); }); Route::middleware([ ‘auth:sanctum’, config(‘jetstream.auth_session’), ‘verified’ ])->group(function () { Route::resource(‘pdfs’, PdfController::class); }); >Solution : Option 1: You can achieve it with something like this in your route: Route::resource(‘pdfs’, PdfController::class)->only([‘show’]); Route::middleware([ ‘auth:sanctum’, config(‘jetstream.auth_session’), ‘verified’ ])->group(function () { Route::resource(‘pdfs’, PdfController::class)->except([‘show’]);… Read More I need to make auth on all resource controller except show class

How to unit test if the user is being redirected to login page if email not validated

I’m trying to write some unit tests for my code, I’m just learning how to write tests and I’m new to Laravel. Basically, I have a simple project, where the user should register and after validating their email, they are redirected to the landing page. In order to avoid some infinite redirects and bugs, I… Read More How to unit test if the user is being redirected to login page if email not validated