Commit 1224e71f by Azhan Hannan

Model Project - add use eloquent softdeletes.

Maintenance controller - checking project code untuk new project.
parent d9153a0f
...@@ -105,7 +105,13 @@ class MaintenanceController extends Controller ...@@ -105,7 +105,13 @@ class MaintenanceController extends Controller
public function addnewproject(Request $request) public function addnewproject(Request $request)
{ {
// dd($request); $checkcode = Project::where('p_project_code', $request->projectcode)
->first();
if($checkcode)
{
return redirect()->route('timesheet::maintenance.penambahanProject')->withErrors('Project code already exist. Kindly enter another code for the project.');
}
$chargeable = 1; $chargeable = 1;
...@@ -115,7 +121,7 @@ class MaintenanceController extends Controller ...@@ -115,7 +121,7 @@ class MaintenanceController extends Controller
if ($request->projectcode == null || $request->projectname == null || $request->projectmanager == null) { if ($request->projectcode == null || $request->projectname == null || $request->projectmanager == null) {
return redirect()->route('timesheet::maintenance.penambahanProject') return redirect()->route('timesheet::maintenance.penambahanProject')
->withErrors('The information is not complete. Please re-enter!'); ->withErrors('The information is not complete. Please re-enter the details.');
} else { } else {
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
namespace Portal\Timesheet\Model; namespace Portal\Timesheet\Model;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Project extends Model class Project extends Model
{ {
...@@ -11,6 +12,8 @@ class Project extends Model ...@@ -11,6 +12,8 @@ class Project extends Model
* *
* @var string * @var string
*/ */
use SoftDeletes;
protected $table = 'project'; protected $table = 'project';
public function projectManager() public function projectManager()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment