Made it so you get send to index after you make,edit and update user information
This commit is contained in:
parent
2b69938251
commit
eb48514545
|
@ -5,6 +5,7 @@ namespace App\Http\Controllers;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Http\Response;
|
use Illuminate\Http\Response;
|
||||||
use App\Contact;
|
use App\Contact;
|
||||||
|
use phpDocumentor\Reflection\Types\Context;
|
||||||
|
|
||||||
class ContactController extends Controller
|
class ContactController extends Controller
|
||||||
{
|
{
|
||||||
|
@ -59,9 +60,15 @@ class ContactController extends Controller
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$contact = new Contact($requestContact);
|
$contact = new Contact($requestContact);
|
||||||
$contact->save();
|
$saved = $contact->save();
|
||||||
|
|
||||||
|
if(!$saved){
|
||||||
|
return Response::detect("contacts.store");
|
||||||
|
}else{
|
||||||
|
$contact = Contact::query()->paginate($request->input("limit", 20));
|
||||||
|
return Response::detect("contacts.index", ['contacts' => $contact]);
|
||||||
|
}
|
||||||
|
|
||||||
return Response::detect("contacts.store");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -101,9 +108,15 @@ class ContactController extends Controller
|
||||||
$data = $request->all();
|
$data = $request->all();
|
||||||
$contact = Contact::find($id);
|
$contact = Contact::find($id);
|
||||||
$contact->update($data);
|
$contact->update($data);
|
||||||
$contact->save();
|
$saved = $contact->save();
|
||||||
|
|
||||||
|
if(!$saved){
|
||||||
|
return Response::detect("contacts.update", [ "contacts" => $contact ]);
|
||||||
|
}else{
|
||||||
|
$contact = Contact::query()->paginate($request->input("limit", 20));
|
||||||
|
return Response::detect("contacts.index", ['contacts' => $contact]);
|
||||||
|
}
|
||||||
|
|
||||||
return Response::detect("contacts.update", [ "contacts" => $contact ]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue