chore: run laravel pint
This commit is contained in:
parent
13ccfeac13
commit
e133f020cf
@ -10,17 +10,23 @@
|
|||||||
use Maatwebsite\Excel\Concerns\WithStyles;
|
use Maatwebsite\Excel\Concerns\WithStyles;
|
||||||
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
||||||
|
|
||||||
class CompanyExport implements FromCollection, WithHeadings, WithStyles, WithMapping
|
class CompanyExport implements FromCollection, WithHeadings, WithMapping, WithStyles
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @return \Illuminate\Support\Collection
|
* @return \Illuminate\Support\Collection
|
||||||
*/
|
*/
|
||||||
protected $no = 1;
|
protected $no = 1;
|
||||||
|
|
||||||
protected $status;
|
protected $status;
|
||||||
|
|
||||||
protected $edit_status;
|
protected $edit_status;
|
||||||
|
|
||||||
protected $address;
|
protected $address;
|
||||||
|
|
||||||
protected $register_year;
|
protected $register_year;
|
||||||
|
|
||||||
protected $register_month;
|
protected $register_month;
|
||||||
|
|
||||||
protected $register_date;
|
protected $register_date;
|
||||||
|
|
||||||
public function __construct($status, $edit_status, $address, $register_year, $register_month, $register_date)
|
public function __construct($status, $edit_status, $address, $register_year, $register_month, $register_date)
|
||||||
@ -32,6 +38,7 @@ public function __construct($status, $edit_status, $address, $register_year, $re
|
|||||||
$this->register_month = $register_month;
|
$this->register_month = $register_month;
|
||||||
$this->register_date = $register_date;
|
$this->register_date = $register_date;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function collection()
|
public function collection()
|
||||||
{
|
{
|
||||||
$query = Company::with(['user']);
|
$query = Company::with(['user']);
|
||||||
@ -96,7 +103,7 @@ public function map($company): array
|
|||||||
get_user_status($company->user->status),
|
get_user_status($company->user->status),
|
||||||
get_edit_status($company->edit_status),
|
get_edit_status($company->edit_status),
|
||||||
Carbon::parse($company->created_at)->locale('id')->translatedFormat('l, d F Y'),
|
Carbon::parse($company->created_at)->locale('id')->translatedFormat('l, d F Y'),
|
||||||
Carbon::parse($company->validated_at)->locale('id')->translatedFormat('l, d F Y')
|
Carbon::parse($company->validated_at)->locale('id')->translatedFormat('l, d F Y'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,7 +111,7 @@ public function headings(): array
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
['Data Perusahaan', '', '', '', '', '', '', '', '', ''],
|
['Data Perusahaan', '', '', '', '', '', '', '', '', ''],
|
||||||
['NO', 'Nama Perusahaan', 'Email', 'Direktur', 'Alamat', 'Status', 'Status Edit', 'Tanggal Daftar', 'Tanggal Validasi']
|
['NO', 'Nama Perusahaan', 'Email', 'Direktur', 'Alamat', 'Status', 'Status Edit', 'Tanggal Daftar', 'Tanggal Validasi'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -10,19 +10,25 @@
|
|||||||
use Maatwebsite\Excel\Concerns\WithStyles;
|
use Maatwebsite\Excel\Concerns\WithStyles;
|
||||||
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
||||||
|
|
||||||
|
class ContentRecapExport implements FromCollection, WithHeadings, WithMapping, WithStyles
|
||||||
class ContentRecapExport implements FromCollection, WithHeadings, WithStyles, WithMapping
|
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @return \Illuminate\Support\Collection
|
* @return \Illuminate\Support\Collection
|
||||||
*/
|
*/
|
||||||
protected $no = 1;
|
protected $no = 1;
|
||||||
|
|
||||||
protected $classification;
|
protected $classification;
|
||||||
|
|
||||||
protected $channel;
|
protected $channel;
|
||||||
|
|
||||||
protected $social_media;
|
protected $social_media;
|
||||||
|
|
||||||
protected $content_type;
|
protected $content_type;
|
||||||
|
|
||||||
protected $posted_year;
|
protected $posted_year;
|
||||||
|
|
||||||
protected $posted_month;
|
protected $posted_month;
|
||||||
|
|
||||||
protected $posted_date;
|
protected $posted_date;
|
||||||
|
|
||||||
public function __construct($classification, $channel, $social_media, $content_type, $posted_year, $posted_month, $posted_date)
|
public function __construct($classification, $channel, $social_media, $content_type, $posted_year, $posted_month, $posted_date)
|
||||||
@ -93,7 +99,7 @@ public function headings(): array
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
['Data Rekap Konten', '', '', '', '', '', '', '', '', ''],
|
['Data Rekap Konten', '', '', '', '', '', '', '', '', ''],
|
||||||
['NO', 'Tema Konten', 'Link', 'Klasifikasi', 'Media Sosial', 'Jenis Konten', 'Tanggal Posting', 'Channel', 'Deskripsi', 'Dibuat Pada']
|
['NO', 'Tema Konten', 'Link', 'Klasifikasi', 'Media Sosial', 'Jenis Konten', 'Tanggal Posting', 'Channel', 'Deskripsi', 'Dibuat Pada'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -11,15 +11,17 @@
|
|||||||
use Maatwebsite\Excel\Concerns\WithStyles;
|
use Maatwebsite\Excel\Concerns\WithStyles;
|
||||||
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
||||||
|
|
||||||
class CooperationArchiveExport implements FromCollection, WithHeadings, WithStyles, WithMapping
|
class CooperationArchiveExport implements FromCollection, WithHeadings, WithMapping, WithStyles
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @return \Illuminate\Support\Collection
|
* @return \Illuminate\Support\Collection
|
||||||
*/
|
*/
|
||||||
|
|
||||||
protected $no = 1;
|
protected $no = 1;
|
||||||
|
|
||||||
protected $year;
|
protected $year;
|
||||||
|
|
||||||
protected $month;
|
protected $month;
|
||||||
|
|
||||||
protected $date;
|
protected $date;
|
||||||
|
|
||||||
public function __construct($year, $month, $date)
|
public function __construct($year, $month, $date)
|
||||||
@ -83,7 +85,7 @@ public function headings(): array
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
['Data Rekap Konten', '', '', '', '', ''],
|
['Data Rekap Konten', '', '', '', '', ''],
|
||||||
['NO', 'Nama Kerja Sama', 'Taanggal Mulai', 'Tanggal Selesai', 'Deskripsi', 'Dibuat Pada']
|
['NO', 'Nama Kerja Sama', 'Taanggal Mulai', 'Tanggal Selesai', 'Deskripsi', 'Dibuat Pada'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,25 +3,31 @@
|
|||||||
namespace App\Exports;
|
namespace App\Exports;
|
||||||
|
|
||||||
use App\Models\CooperationCompletion;
|
use App\Models\CooperationCompletion;
|
||||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||||
use Maatwebsite\Excel\Concerns\WithStyles;
|
use Maatwebsite\Excel\Concerns\WithStyles;
|
||||||
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
||||||
|
|
||||||
class CooperationCompletionExport implements FromCollection, WithHeadings, WithStyles, WithMapping
|
class CooperationCompletionExport implements FromCollection, WithHeadings, WithMapping, WithStyles
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @return \Illuminate\Support\Collection
|
* @return \Illuminate\Support\Collection
|
||||||
*/
|
*/
|
||||||
protected $no = 1;
|
protected $no = 1;
|
||||||
|
|
||||||
protected $media;
|
protected $media;
|
||||||
|
|
||||||
protected $status;
|
protected $status;
|
||||||
|
|
||||||
protected $year;
|
protected $year;
|
||||||
|
|
||||||
protected $from_month;
|
protected $from_month;
|
||||||
|
|
||||||
protected $to_month;
|
protected $to_month;
|
||||||
|
|
||||||
protected $date;
|
protected $date;
|
||||||
|
|
||||||
public function __construct($media, $status, $year, $from_month, $to_month, $date)
|
public function __construct($media, $status, $year, $from_month, $to_month, $date)
|
||||||
@ -95,7 +101,7 @@ public function headings(): array
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
['Penyelesaian Kerja Sama', '', '', '', '', ''],
|
['Penyelesaian Kerja Sama', '', '', '', '', ''],
|
||||||
['NO', 'Nama Kerja Sama', 'Media', 'Perusahaan', 'Tanggal Upload', 'Status']
|
['NO', 'Nama Kerja Sama', 'Media', 'Perusahaan', 'Tanggal Upload', 'Status'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,6 @@
|
|||||||
namespace App\Exports;
|
namespace App\Exports;
|
||||||
|
|
||||||
use App\Models\Cooperation;
|
use App\Models\Cooperation;
|
||||||
use App\Models\Media;
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||||
@ -12,15 +11,17 @@
|
|||||||
use Maatwebsite\Excel\Concerns\WithStyles;
|
use Maatwebsite\Excel\Concerns\WithStyles;
|
||||||
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
||||||
|
|
||||||
class CooperationExport implements FromCollection, WithHeadings, WithStyles, WithMapping
|
class CooperationExport implements FromCollection, WithHeadings, WithMapping, WithStyles
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @return \Illuminate\Support\Collection
|
* @return \Illuminate\Support\Collection
|
||||||
*/
|
*/
|
||||||
|
|
||||||
protected $no = 1;
|
protected $no = 1;
|
||||||
|
|
||||||
protected $year;
|
protected $year;
|
||||||
|
|
||||||
protected $month;
|
protected $month;
|
||||||
|
|
||||||
protected $date;
|
protected $date;
|
||||||
|
|
||||||
public function __construct($year, $month, $date)
|
public function __construct($year, $month, $date)
|
||||||
@ -77,7 +78,7 @@ public function headings(): array
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
['Data Rekap Konten', '', '', '', '', '', ''],
|
['Data Rekap Konten', '', '', '', '', '', ''],
|
||||||
['NO', 'Nama Kerja Sama', 'Tanggal Mulai', 'Tanggal Selesai', 'Deskripsi', 'Media', 'Dibuat Pada']
|
['NO', 'Nama Kerja Sama', 'Tanggal Mulai', 'Tanggal Selesai', 'Deskripsi', 'Media', 'Dibuat Pada'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -10,18 +10,23 @@
|
|||||||
use Maatwebsite\Excel\Concerns\WithStyles;
|
use Maatwebsite\Excel\Concerns\WithStyles;
|
||||||
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
||||||
|
|
||||||
class JournalistExport implements FromCollection, WithHeadings, WithStyles, WithMapping
|
class JournalistExport implements FromCollection, WithHeadings, WithMapping, WithStyles
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @return \Illuminate\Support\Collection
|
* @return \Illuminate\Support\Collection
|
||||||
*/
|
*/
|
||||||
|
|
||||||
protected $no = 1;
|
protected $no = 1;
|
||||||
|
|
||||||
protected $media_ids;
|
protected $media_ids;
|
||||||
|
|
||||||
protected $status;
|
protected $status;
|
||||||
|
|
||||||
protected $edit_status;
|
protected $edit_status;
|
||||||
|
|
||||||
protected $register_year;
|
protected $register_year;
|
||||||
|
|
||||||
protected $register_month;
|
protected $register_month;
|
||||||
|
|
||||||
protected $register_date;
|
protected $register_date;
|
||||||
|
|
||||||
public function __construct($media_ids, $status, $edit_status, $register_year, $register_month, $register_date)
|
public function __construct($media_ids, $status, $edit_status, $register_year, $register_month, $register_date)
|
||||||
@ -113,7 +118,7 @@ public function headings(): array
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
['Data Jurnalis', '', '', '', '', '', '', ''],
|
['Data Jurnalis', '', '', '', '', '', '', ''],
|
||||||
['NO', 'Nama Jurnalis', 'Nama Media', 'Nama Perusahaan', 'Email', 'Status', 'Status Edit', 'Tanggal Daftar']
|
['NO', 'Nama Jurnalis', 'Nama Media', 'Nama Perusahaan', 'Email', 'Status', 'Status Edit', 'Tanggal Daftar'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -10,20 +10,27 @@
|
|||||||
use Maatwebsite\Excel\Concerns\WithStyles;
|
use Maatwebsite\Excel\Concerns\WithStyles;
|
||||||
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
||||||
|
|
||||||
class MediaExport implements FromCollection, WithHeadings, WithStyles, WithMapping
|
class MediaExport implements FromCollection, WithHeadings, WithMapping, WithStyles
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @return \Illuminate\Support\Collection
|
* @return \Illuminate\Support\Collection
|
||||||
*/
|
*/
|
||||||
|
|
||||||
protected $no = 1;
|
protected $no = 1;
|
||||||
|
|
||||||
protected $type;
|
protected $type;
|
||||||
|
|
||||||
protected $classification;
|
protected $classification;
|
||||||
|
|
||||||
protected $status;
|
protected $status;
|
||||||
|
|
||||||
protected $edit_status;
|
protected $edit_status;
|
||||||
|
|
||||||
protected $address;
|
protected $address;
|
||||||
|
|
||||||
protected $register_year;
|
protected $register_year;
|
||||||
|
|
||||||
protected $register_month;
|
protected $register_month;
|
||||||
|
|
||||||
protected $register_date;
|
protected $register_date;
|
||||||
|
|
||||||
public function __construct($type, $classification, $status, $edit_status, $address, $register_year, $register_month, $register_date)
|
public function __construct($type, $classification, $status, $edit_status, $address, $register_year, $register_month, $register_date)
|
||||||
@ -126,7 +133,7 @@ public function map($media): array
|
|||||||
get_user_status($media->company->user->status),
|
get_user_status($media->company->user->status),
|
||||||
get_edit_status($media->edit_status),
|
get_edit_status($media->edit_status),
|
||||||
Carbon::parse($media->created_at)->locale('id')->translatedFormat('l, d F Y'),
|
Carbon::parse($media->created_at)->locale('id')->translatedFormat('l, d F Y'),
|
||||||
Carbon::parse($media->company->validated_at)->locale('id')->translatedFormat('l, d F Y')
|
Carbon::parse($media->company->validated_at)->locale('id')->translatedFormat('l, d F Y'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,7 +141,7 @@ public function headings(): array
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
['Data Media', '', '', '', '', '', '', '', '', '', '', ''],
|
['Data Media', '', '', '', '', '', '', '', '', '', '', ''],
|
||||||
['NO', 'Nama Media', 'Nama Perusahaan', 'Email', 'Tipe', 'Klasifikasi', 'Alamat', 'Status', 'Status Edit', 'Tanggal Daftar', 'Tanggal Validasi']
|
['NO', 'Nama Media', 'Nama Perusahaan', 'Email', 'Tipe', 'Klasifikasi', 'Alamat', 'Status', 'Status Edit', 'Tanggal Daftar', 'Tanggal Validasi'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -10,22 +10,31 @@
|
|||||||
use Maatwebsite\Excel\Concerns\WithStyles;
|
use Maatwebsite\Excel\Concerns\WithStyles;
|
||||||
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
||||||
|
|
||||||
class MediaMonitoringExport implements FromCollection, WithHeadings, WithStyles, WithMapping
|
class MediaMonitoringExport implements FromCollection, WithHeadings, WithMapping, WithStyles
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @return \Illuminate\Support\Collection
|
* @return \Illuminate\Support\Collection
|
||||||
*/
|
*/
|
||||||
|
|
||||||
protected $no = 1;
|
protected $no = 1;
|
||||||
|
|
||||||
protected $news_title;
|
protected $news_title;
|
||||||
|
|
||||||
protected $channel;
|
protected $channel;
|
||||||
|
|
||||||
protected $issue_status;
|
protected $issue_status;
|
||||||
|
|
||||||
protected $keyword;
|
protected $keyword;
|
||||||
|
|
||||||
protected $input_year;
|
protected $input_year;
|
||||||
|
|
||||||
protected $input_month;
|
protected $input_month;
|
||||||
|
|
||||||
protected $input_date;
|
protected $input_date;
|
||||||
|
|
||||||
protected $release_year;
|
protected $release_year;
|
||||||
|
|
||||||
protected $release_month;
|
protected $release_month;
|
||||||
|
|
||||||
protected $release_date;
|
protected $release_date;
|
||||||
|
|
||||||
public function __construct($news_title, $channel, $issue_status, $keyword, $input_year, $input_month, $input_date, $release_year, $release_month, $release_date)
|
public function __construct($news_title, $channel, $issue_status, $keyword, $input_year, $input_month, $input_date, $release_year, $release_month, $release_date)
|
||||||
@ -123,7 +132,7 @@ public function headings(): array
|
|||||||
return [
|
return [
|
||||||
['Data Monitoring Media', '', '', '', '', '', '', '', '', '', '', '', '', ''],
|
['Data Monitoring Media', '', '', '', '', '', '', '', '', '', '', '', '', ''],
|
||||||
['NO', 'Kode', 'Judul Berita', 'Media', 'Tema', 'Penulis', 'Channel', 'Kata Kunci', 'Influencer', 'Link', 'Halaman Berita', 'Tanggal Rilis', 'Status Isu', 'Oleh',
|
['NO', 'Kode', 'Judul Berita', 'Media', 'Tema', 'Penulis', 'Channel', 'Kata Kunci', 'Influencer', 'Link', 'Halaman Berita', 'Tanggal Rilis', 'Status Isu', 'Oleh',
|
||||||
'Tanggal Input']
|
'Tanggal Input'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4,23 +4,25 @@
|
|||||||
|
|
||||||
use App\Models\News;
|
use App\Models\News;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Illuminate\Support\Facades\Log;
|
|
||||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||||
use Maatwebsite\Excel\Concerns\WithStyles;
|
use Maatwebsite\Excel\Concerns\WithStyles;
|
||||||
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
||||||
|
|
||||||
class NewsExport implements FromCollection, WithHeadings, WithStyles, WithMapping
|
class NewsExport implements FromCollection, WithHeadings, WithMapping, WithStyles
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @return \Illuminate\Support\Collection
|
* @return \Illuminate\Support\Collection
|
||||||
*/
|
*/
|
||||||
|
|
||||||
protected $no = 1;
|
protected $no = 1;
|
||||||
|
|
||||||
protected $category;
|
protected $category;
|
||||||
|
|
||||||
protected $year;
|
protected $year;
|
||||||
|
|
||||||
protected $month;
|
protected $month;
|
||||||
|
|
||||||
protected $date;
|
protected $date;
|
||||||
|
|
||||||
public function __construct($category, $year, $month, $date)
|
public function __construct($category, $year, $month, $date)
|
||||||
@ -30,6 +32,7 @@ public function __construct($category, $year, $month, $date)
|
|||||||
$this->month = $month;
|
$this->month = $month;
|
||||||
$this->date = $date;
|
$this->date = $date;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function collection()
|
public function collection()
|
||||||
{
|
{
|
||||||
$query = News::query();
|
$query = News::query();
|
||||||
@ -77,7 +80,7 @@ public function headings(): array
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
['Data Berita', '', '', '', '', '', '', ''],
|
['Data Berita', '', '', '', '', '', '', ''],
|
||||||
['NO', 'Judul', 'Link', 'Tag', 'Kategori', 'Dilihat', 'Dibuat Pada', 'Dibuat Oleh']
|
['NO', 'Judul', 'Link', 'Tag', 'Kategori', 'Dilihat', 'Dibuat Pada', 'Dibuat Oleh'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,26 +3,31 @@
|
|||||||
namespace App\Exports;
|
namespace App\Exports;
|
||||||
|
|
||||||
use App\Models\Report;
|
use App\Models\Report;
|
||||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||||
use Maatwebsite\Excel\Concerns\WithStyles;
|
use Maatwebsite\Excel\Concerns\WithStyles;
|
||||||
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
||||||
|
|
||||||
class ReportExport implements FromCollection, WithHeadings, WithStyles, WithMapping
|
class ReportExport implements FromCollection, WithHeadings, WithMapping, WithStyles
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @return \Illuminate\Support\Collection
|
* @return \Illuminate\Support\Collection
|
||||||
*/
|
*/
|
||||||
|
|
||||||
protected $no = 1;
|
protected $no = 1;
|
||||||
|
|
||||||
protected $media;
|
protected $media;
|
||||||
|
|
||||||
protected $status;
|
protected $status;
|
||||||
|
|
||||||
protected $year;
|
protected $year;
|
||||||
|
|
||||||
protected $from_month;
|
protected $from_month;
|
||||||
|
|
||||||
protected $to_month;
|
protected $to_month;
|
||||||
|
|
||||||
protected $date;
|
protected $date;
|
||||||
|
|
||||||
public function __construct($media, $status, $year, $from_month, $to_month, $date)
|
public function __construct($media, $status, $year, $from_month, $to_month, $date)
|
||||||
@ -97,7 +102,7 @@ public function headings(): array
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
['Laporan Bukti Tayang', '', '', '', '', '', '', ''],
|
['Laporan Bukti Tayang', '', '', '', '', '', '', ''],
|
||||||
['NO', 'Nama Kerja Sama', 'Media', 'Perusahaan', 'Tanggal Upload', 'Tanggal Melaporkan', 'Status']
|
['NO', 'Nama Kerja Sama', 'Media', 'Perusahaan', 'Tanggal Upload', 'Tanggal Melaporkan', 'Status'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,12 +2,10 @@
|
|||||||
|
|
||||||
use App\Models\Media;
|
use App\Models\Media;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Settings\AppSettings;
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Hashids\Hashids;
|
use Hashids\Hashids;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Illuminate\Support\Facades\File;
|
use Illuminate\Support\Facades\File;
|
||||||
use Illuminate\Support\Facades\Log;
|
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
@ -183,6 +181,7 @@ function delete_file($path)
|
|||||||
|
|
||||||
if (File::exists($fullPath)) {
|
if (File::exists($fullPath)) {
|
||||||
File::delete($fullPath);
|
File::delete($fullPath);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,17 +206,17 @@ function get_role_name($role = null)
|
|||||||
|
|
||||||
switch ($role) {
|
switch ($role) {
|
||||||
case '1':
|
case '1':
|
||||||
return "Administrator";
|
return 'Administrator';
|
||||||
case '2':
|
case '2':
|
||||||
return "Admin Monitoring";
|
return 'Admin Monitoring';
|
||||||
case '3':
|
case '3':
|
||||||
return "Perusahaan";
|
return 'Perusahaan';
|
||||||
case '4':
|
case '4':
|
||||||
return "Admin Konten";
|
return 'Admin Konten';
|
||||||
case '5':
|
case '5':
|
||||||
return "Admin Keuangan";
|
return 'Admin Keuangan';
|
||||||
default:
|
default:
|
||||||
return "Role Tidak Dikenal";
|
return 'Role Tidak Dikenal';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -239,6 +238,7 @@ function is_role($roles)
|
|||||||
if (Auth::check()) {
|
if (Auth::check()) {
|
||||||
return in_array(Auth::user()->role_id, (array) $roles) || Auth::user()->role_id === '4';
|
return in_array(Auth::user()->role_id, (array) $roles) || Auth::user()->role_id === '4';
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -247,6 +247,7 @@ function is_role($roles)
|
|||||||
function encrypt_id($id)
|
function encrypt_id($id)
|
||||||
{
|
{
|
||||||
$hashids = new Hashids('alwayssaybismillahirrahmanirrahim', 15);
|
$hashids = new Hashids('alwayssaybismillahirrahmanirrahim', 15);
|
||||||
|
|
||||||
return $hashids->encode($id);
|
return $hashids->encode($id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -256,6 +257,7 @@ function decrypt_id($hash)
|
|||||||
{
|
{
|
||||||
$hashids = new Hashids('alwayssaybismillahirrahmanirrahim', 15);
|
$hashids = new Hashids('alwayssaybismillahirrahmanirrahim', 15);
|
||||||
$result = $hashids->decode($hash);
|
$result = $hashids->decode($hash);
|
||||||
|
|
||||||
return $result ? $result[0] : null;
|
return $result ? $result[0] : null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -278,7 +280,7 @@ function get_user_status($status)
|
|||||||
case '2':
|
case '2':
|
||||||
return 'Ditolak';
|
return 'Ditolak';
|
||||||
default:
|
default:
|
||||||
return "Tidak Diketahui";
|
return 'Tidak Diketahui';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -296,7 +298,7 @@ function get_edit_status($status)
|
|||||||
case '3':
|
case '3':
|
||||||
return 'Ditolak';
|
return 'Ditolak';
|
||||||
default:
|
default:
|
||||||
return "Tidak Diketahui";
|
return 'Tidak Diketahui';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -309,6 +311,7 @@ function get_cooperation_notif()
|
|||||||
$mediaId = $user->company->media->id;
|
$mediaId = $user->company->media->id;
|
||||||
|
|
||||||
$media = Media::with('cooperations')->findOrFail($mediaId);
|
$media = Media::with('cooperations')->findOrFail($mediaId);
|
||||||
|
|
||||||
return $media->cooperations()
|
return $media->cooperations()
|
||||||
->where('start_date', '<=', Carbon::now()->locale('id')->toDateString())
|
->where('start_date', '<=', Carbon::now()->locale('id')->toDateString())
|
||||||
->where('end_date', '>=', Carbon::now()->locale('id')->toDateString())
|
->where('end_date', '>=', Carbon::now()->locale('id')->toDateString())
|
||||||
@ -334,6 +337,7 @@ function get_unread_announcements()
|
|||||||
$userId = $user->id;
|
$userId = $user->id;
|
||||||
|
|
||||||
$user = User::with('announcements')->findOrFail($userId);
|
$user = User::with('announcements')->findOrFail($userId);
|
||||||
|
|
||||||
return $user->announcements()
|
return $user->announcements()
|
||||||
->wherePivot('status', '=', '0')
|
->wherePivot('status', '=', '0')
|
||||||
->count();
|
->count();
|
||||||
@ -450,97 +454,97 @@ function get_activity_log_name($name)
|
|||||||
case 'airing_proof_theme':
|
case 'airing_proof_theme':
|
||||||
return [
|
return [
|
||||||
'name' => 'Tema Bukti Tayang',
|
'name' => 'Tema Bukti Tayang',
|
||||||
'route' => 'dashboard.airing.proof.themes.show'
|
'route' => 'dashboard.airing.proof.themes.show',
|
||||||
];
|
];
|
||||||
case 'announcement':
|
case 'announcement':
|
||||||
return [
|
return [
|
||||||
'name' => 'Pengumuman',
|
'name' => 'Pengumuman',
|
||||||
'route' => 'dashboard.announcements.show'
|
'route' => 'dashboard.announcements.show',
|
||||||
];
|
];
|
||||||
case 'classification':
|
case 'classification':
|
||||||
return [
|
return [
|
||||||
'name' => 'Klasifikasi',
|
'name' => 'Klasifikasi',
|
||||||
'route' => 'dashboard.classifications.show'
|
'route' => 'dashboard.classifications.show',
|
||||||
];
|
];
|
||||||
case 'content_recap':
|
case 'content_recap':
|
||||||
return [
|
return [
|
||||||
'name' => 'Rekap Konten',
|
'name' => 'Rekap Konten',
|
||||||
'route' => 'dashboard.content.recaps.show'
|
'route' => 'dashboard.content.recaps.show',
|
||||||
];
|
];
|
||||||
case 'content_recap_classification':
|
case 'content_recap_classification':
|
||||||
return [
|
return [
|
||||||
'name' => 'Klasifikasi Rekap Konten',
|
'name' => 'Klasifikasi Rekap Konten',
|
||||||
'route' => 'dashboard.content.recap.classifications.show'
|
'route' => 'dashboard.content.recap.classifications.show',
|
||||||
];
|
];
|
||||||
case 'cooperation':
|
case 'cooperation':
|
||||||
return [
|
return [
|
||||||
'name' => 'Kerja Sama',
|
'name' => 'Kerja Sama',
|
||||||
'route' => 'dashboard.cooperations.show'
|
'route' => 'dashboard.cooperations.show',
|
||||||
];
|
];
|
||||||
case 'cooperation_completion':
|
case 'cooperation_completion':
|
||||||
return [
|
return [
|
||||||
'name' => 'Penyelesaian Kerja Sama',
|
'name' => 'Penyelesaian Kerja Sama',
|
||||||
'route' => 'dashboard.cooperation.completions.show'
|
'route' => 'dashboard.cooperation.completions.show',
|
||||||
];
|
];
|
||||||
case 'cooperation_proposal':
|
case 'cooperation_proposal':
|
||||||
return [
|
return [
|
||||||
'name' => 'Pengajuan Kerja Sama',
|
'name' => 'Pengajuan Kerja Sama',
|
||||||
'route' => 'dashboard.cooperations.media.proposal.show'
|
'route' => 'dashboard.cooperations.media.proposal.show',
|
||||||
];
|
];
|
||||||
case 'government_agency':
|
case 'government_agency':
|
||||||
return [
|
return [
|
||||||
'name' => 'OPD',
|
'name' => 'OPD',
|
||||||
'route' => 'dashboard.government.agencies.show'
|
'route' => 'dashboard.government.agencies.show',
|
||||||
];
|
];
|
||||||
case 'issue_management':
|
case 'issue_management':
|
||||||
return [
|
return [
|
||||||
'name' => 'Manajemen Isu',
|
'name' => 'Manajemen Isu',
|
||||||
'route' => 'dashboard.issue.managements.show'
|
'route' => 'dashboard.issue.managements.show',
|
||||||
];
|
];
|
||||||
case 'location':
|
case 'location':
|
||||||
return [
|
return [
|
||||||
'name' => 'Location',
|
'name' => 'Location',
|
||||||
'route' => 'dashboard.locations.show'
|
'route' => 'dashboard.locations.show',
|
||||||
];
|
];
|
||||||
case 'media_monitoring':
|
case 'media_monitoring':
|
||||||
return [
|
return [
|
||||||
'name' => 'Monitoring Media',
|
'name' => 'Monitoring Media',
|
||||||
'route' => 'dashboard.media.monitorings.show'
|
'route' => 'dashboard.media.monitorings.show',
|
||||||
];
|
];
|
||||||
case 'news':
|
case 'news':
|
||||||
return [
|
return [
|
||||||
'name' => 'Berita',
|
'name' => 'Berita',
|
||||||
'route' => 'dashboard.news.show'
|
'route' => 'dashboard.news.show',
|
||||||
];
|
];
|
||||||
case 'order':
|
case 'order':
|
||||||
return [
|
return [
|
||||||
'name' => 'Media Order',
|
'name' => 'Media Order',
|
||||||
'route' => 'dashboard.media.orders.show'
|
'route' => 'dashboard.media.orders.show',
|
||||||
];
|
];
|
||||||
case 'airing_proof_report':
|
case 'airing_proof_report':
|
||||||
return [
|
return [
|
||||||
'name' => 'Laporan Bukti Tayang',
|
'name' => 'Laporan Bukti Tayang',
|
||||||
'route' => 'dashboard.reports.show'
|
'route' => 'dashboard.reports.show',
|
||||||
];
|
];
|
||||||
case 'user_role':
|
case 'user_role':
|
||||||
return [
|
return [
|
||||||
'name' => 'Hak Akses',
|
'name' => 'Hak Akses',
|
||||||
'route' => 'dashboard.role.index'
|
'route' => 'dashboard.role.index',
|
||||||
];
|
];
|
||||||
case 'sub_classification':
|
case 'sub_classification':
|
||||||
return [
|
return [
|
||||||
'name' => 'Sub Klasifikasi',
|
'name' => 'Sub Klasifikasi',
|
||||||
'route' => 'dashboard.sub.classifications.show'
|
'route' => 'dashboard.sub.classifications.show',
|
||||||
];
|
];
|
||||||
case 'sub_location':
|
case 'sub_location':
|
||||||
return [
|
return [
|
||||||
'name' => 'Sub Lokasi',
|
'name' => 'Sub Lokasi',
|
||||||
'route' => 'dashboard.sub.locations.show'
|
'route' => 'dashboard.sub.locations.show',
|
||||||
];
|
];
|
||||||
default:
|
default:
|
||||||
return [
|
return [
|
||||||
'name' => 'Tidak Valid',
|
'name' => 'Tidak Valid',
|
||||||
'route' => null
|
'route' => null,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,7 +17,7 @@ class AuthController extends Controller
|
|||||||
public function login()
|
public function login()
|
||||||
{
|
{
|
||||||
return view('auth.login', [
|
return view('auth.login', [
|
||||||
'title' => 'Masuk'
|
'title' => 'Masuk',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -27,6 +27,7 @@ public function loginAction(LoginRequest $request)
|
|||||||
|
|
||||||
if (Auth::attempt(['email' => $validatedData['email'], 'password' => $validatedData['password']])) {
|
if (Auth::attempt(['email' => $validatedData['email'], 'password' => $validatedData['password']])) {
|
||||||
$request->session()->regenerate();
|
$request->session()->regenerate();
|
||||||
|
|
||||||
return redirect()->intended('/dashboard/overview');
|
return redirect()->intended('/dashboard/overview');
|
||||||
} else {
|
} else {
|
||||||
return redirect()->back()->with('failed-status', 'Pastikan data dan akun sudah terdaftar.');
|
return redirect()->back()->with('failed-status', 'Pastikan data dan akun sudah terdaftar.');
|
||||||
@ -37,7 +38,7 @@ public function register()
|
|||||||
{
|
{
|
||||||
return view('auth.register', [
|
return view('auth.register', [
|
||||||
'title' => 'Daftar',
|
'title' => 'Daftar',
|
||||||
'sample' => "Hai"
|
'sample' => 'Hai',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,7 +104,7 @@ public function registerAction(RegisterRequest $request)
|
|||||||
|
|
||||||
$mediaFiles = [
|
$mediaFiles = [
|
||||||
'media_journalism_organization_doc',
|
'media_journalism_organization_doc',
|
||||||
'media_press_council_certificate_doc'
|
'media_press_council_certificate_doc',
|
||||||
];
|
];
|
||||||
|
|
||||||
$mediaFileNames = [];
|
$mediaFileNames = [];
|
||||||
@ -130,7 +131,7 @@ public function registerAction(RegisterRequest $request)
|
|||||||
|
|
||||||
$journalistFiles = [
|
$journalistFiles = [
|
||||||
'journalist_press_card_doc',
|
'journalist_press_card_doc',
|
||||||
'journalist_ukw_sertificate_doc'
|
'journalist_ukw_sertificate_doc',
|
||||||
];
|
];
|
||||||
|
|
||||||
$journalistFileNames = [];
|
$journalistFileNames = [];
|
||||||
@ -154,6 +155,7 @@ public function registerAction(RegisterRequest $request)
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
DB::commit();
|
DB::commit();
|
||||||
|
|
||||||
return redirect()->route('auth.register.success');
|
return redirect()->route('auth.register.success');
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
DB::rollBack();
|
DB::rollBack();
|
||||||
@ -165,7 +167,7 @@ public function registerAction(RegisterRequest $request)
|
|||||||
public function registerSuccess()
|
public function registerSuccess()
|
||||||
{
|
{
|
||||||
return view('auth.register-success', [
|
return view('auth.register-success', [
|
||||||
'title' => 'Daftar Berhasil'
|
'title' => 'Daftar Berhasil',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -9,22 +9,24 @@
|
|||||||
|
|
||||||
class AiringProofThemeController extends Controller
|
class AiringProofThemeController extends Controller
|
||||||
{
|
{
|
||||||
public function index(){
|
public function index()
|
||||||
|
{
|
||||||
return view('dashboard.airing-proof-themes.index', [
|
return view('dashboard.airing-proof-themes.index', [
|
||||||
'title' => "Data Tema Bukti Tayang"
|
'title' => 'Data Tema Bukti Tayang',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function create(){
|
public function create()
|
||||||
|
{
|
||||||
return view('dashboard.airing-proof-themes.create', [
|
return view('dashboard.airing-proof-themes.create', [
|
||||||
'title' => "Buat Tema Bukti Tayang Baru"
|
'title' => 'Buat Tema Bukti Tayang Baru',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function store(AiringProofThemeRequest $request){
|
public function store(AiringProofThemeRequest $request)
|
||||||
|
{
|
||||||
$validatedData = $request->validated();
|
$validatedData = $request->validated();
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$slug = $validatedData['slug'];
|
$slug = $validatedData['slug'];
|
||||||
$existing = AiringProofTheme::withTrashed()
|
$existing = AiringProofTheme::withTrashed()
|
||||||
@ -40,51 +42,58 @@ public function store(AiringProofThemeRequest $request){
|
|||||||
|
|
||||||
$createdAiringProofTheme = AiringProofTheme::create($validatedData);
|
$createdAiringProofTheme = AiringProofTheme::create($validatedData);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("Airing Proof Themes (store): ". $e);
|
Log::error('Airing Proof Themes (store): '.$e);
|
||||||
|
|
||||||
return redirect()->back()->with('failed-status', 'Gagal membuat tema bukti tayang baru.');
|
return redirect()->back()->with('failed-status', 'Gagal membuat tema bukti tayang baru.');
|
||||||
}
|
}
|
||||||
|
|
||||||
return redirect()->route('dashboard.airing.proof.themes.index')->with('success-status', 'Berhasil membuat tema bukti tayang baru.')->with('new_data', encrypt_id($createdAiringProofTheme->id));
|
return redirect()->route('dashboard.airing.proof.themes.index')->with('success-status', 'Berhasil membuat tema bukti tayang baru.')->with('new_data', encrypt_id($createdAiringProofTheme->id));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function edit($id){
|
public function edit($id)
|
||||||
|
{
|
||||||
$airingProofTheme = AiringProofTheme::findOrFail(decrypt_id($id));
|
$airingProofTheme = AiringProofTheme::findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
return view('dashboard.airing-proof-themes.edit', [
|
return view('dashboard.airing-proof-themes.edit', [
|
||||||
'title' => "Ubah Tema Bukti Tayang",
|
'title' => 'Ubah Tema Bukti Tayang',
|
||||||
'airingProofTheme' => $airingProofTheme
|
'airingProofTheme' => $airingProofTheme,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update(AiringProofThemeRequest $request, $id){
|
public function update(AiringProofThemeRequest $request, $id)
|
||||||
|
{
|
||||||
$validatedData = $request->validated();
|
$validatedData = $request->validated();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$airingProofTheme = AiringProofTheme::findOrFail(decrypt_id($id));
|
$airingProofTheme = AiringProofTheme::findOrFail(decrypt_id($id));
|
||||||
$airingProofTheme->update($validatedData);
|
$airingProofTheme->update($validatedData);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("Airing Proof Themes (update): ". $e);
|
Log::error('Airing Proof Themes (update): '.$e);
|
||||||
|
|
||||||
return redirect()->back()->with('failed-status', 'Gagal mengubah tema bukti tayang.');
|
return redirect()->back()->with('failed-status', 'Gagal mengubah tema bukti tayang.');
|
||||||
}
|
}
|
||||||
|
|
||||||
return redirect()->route('dashboard.airing.proof.themes.show', ['id' => encrypt_id($airingProofTheme->id)])->with('success-status', 'Berhasil mengubah tema bukti tayang.');
|
return redirect()->route('dashboard.airing.proof.themes.show', ['id' => encrypt_id($airingProofTheme->id)])->with('success-status', 'Berhasil mengubah tema bukti tayang.');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function show($id){
|
public function show($id)
|
||||||
|
{
|
||||||
$airingProofTheme = AiringProofTheme::findOrFail(decrypt_id($id));
|
$airingProofTheme = AiringProofTheme::findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
return view('dashboard.airing-proof-themes.show', [
|
return view('dashboard.airing-proof-themes.show', [
|
||||||
'title' => "Detail Tema Bukti Tayang",
|
'title' => 'Detail Tema Bukti Tayang',
|
||||||
'airingProofTheme' => $airingProofTheme
|
'airingProofTheme' => $airingProofTheme,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function destroy($id){
|
public function destroy($id)
|
||||||
|
{
|
||||||
try {
|
try {
|
||||||
$airingProofTheme = AiringProofTheme::findOrFail(decrypt_id($id));
|
$airingProofTheme = AiringProofTheme::findOrFail(decrypt_id($id));
|
||||||
$airingProofTheme->delete();
|
$airingProofTheme->delete();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("Airing Proof Themes (destroy): ". $e);
|
Log::error('Airing Proof Themes (destroy): '.$e);
|
||||||
|
|
||||||
return response()->json(['message' => 'Gagal menghapus tema bukti tayang.'], 500);
|
return response()->json(['message' => 'Gagal menghapus tema bukti tayang.'], 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,14 +113,15 @@ public function restore($slug)
|
|||||||
|
|
||||||
if (filled($airingProofTheme->deleted_at)) {
|
if (filled($airingProofTheme->deleted_at)) {
|
||||||
$airingProofTheme->restore();
|
$airingProofTheme->restore();
|
||||||
|
|
||||||
return redirect()->route('dashboard.airing.proof.themes.index')->with('success-status', 'Tema berhasil dipulihkan.');
|
return redirect()->route('dashboard.airing.proof.themes.index')->with('success-status', 'Tema berhasil dipulihkan.');
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("Airing Proof Themes (restore): ". $e);
|
Log::error('Airing Proof Themes (restore): '.$e);
|
||||||
|
|
||||||
return redirect()->back()->with('failed-status', 'Proses pemulihan gagal.');
|
return redirect()->back()->with('failed-status', 'Proses pemulihan gagal.');
|
||||||
}
|
}
|
||||||
|
|
||||||
return redirect()->back()->with('info-status', 'Tema sudah aktif.');
|
return redirect()->back()->with('info-status', 'Tema sudah aktif.');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,6 @@
|
|||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Http\Requests\AnnouncementRequest;
|
use App\Http\Requests\AnnouncementRequest;
|
||||||
use App\Models\Announcement;
|
use App\Models\Announcement;
|
||||||
use App\Models\Media;
|
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
@ -14,10 +13,11 @@
|
|||||||
|
|
||||||
class AnnouncementController extends Controller
|
class AnnouncementController extends Controller
|
||||||
{
|
{
|
||||||
public function index(Request $request){
|
public function index(Request $request)
|
||||||
|
{
|
||||||
$data = [
|
$data = [
|
||||||
'title' => 'Pengumuman',
|
'title' => 'Pengumuman',
|
||||||
'category' => $request->input('category', 'general')
|
'category' => $request->input('category', 'general'),
|
||||||
];
|
];
|
||||||
|
|
||||||
if (is_role(['1'])) {
|
if (is_role(['1'])) {
|
||||||
@ -27,14 +27,16 @@ public function index(Request $request){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function create(){
|
public function create()
|
||||||
|
{
|
||||||
return view('dashboard.announcements.create', [
|
return view('dashboard.announcements.create', [
|
||||||
'title' => 'Buat Pengumuman Baru',
|
'title' => 'Buat Pengumuman Baru',
|
||||||
'users' => User::all()
|
'users' => User::all(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function store(AnnouncementRequest $request){
|
public function store(AnnouncementRequest $request)
|
||||||
|
{
|
||||||
$validatedData = $request->validated();
|
$validatedData = $request->validated();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -47,32 +49,35 @@ public function store(AnnouncementRequest $request){
|
|||||||
$announcement->users()->attach($validatedData['user_ids']);
|
$announcement->users()->attach($validatedData['user_ids']);
|
||||||
|
|
||||||
if ($announcement->users()->count() < 1) {
|
if ($announcement->users()->count() < 1) {
|
||||||
throw new \Exception("Data tidak valid.");
|
throw new \Exception('Data tidak valid.');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $announcement;
|
return $announcement;
|
||||||
});
|
});
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("Announcements (store): ". $e);
|
Log::error('Announcements (store): '.$e);
|
||||||
|
|
||||||
return redirect()->back()->with('failed-status', 'Gagal membuat pengumuman baru');
|
return redirect()->back()->with('failed-status', 'Gagal membuat pengumuman baru');
|
||||||
}
|
}
|
||||||
|
|
||||||
return redirect()->route('dashboard.announcements.index')->with('success-status', 'Berhasil membuat pengumuman baru.')->with('new_data', encrypt_id($announcement->id));
|
return redirect()->route('dashboard.announcements.index')->with('success-status', 'Berhasil membuat pengumuman baru.')->with('new_data', encrypt_id($announcement->id));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function edit($id){
|
public function edit($id)
|
||||||
|
{
|
||||||
$announcement = Announcement::with(['users'])->findOrFail(decrypt_id($id));
|
$announcement = Announcement::with(['users'])->findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
return view('dashboard.announcements.edit', [
|
return view('dashboard.announcements.edit', [
|
||||||
'title' => 'Ubah Pengumuman',
|
'title' => 'Ubah Pengumuman',
|
||||||
'announcement' => $announcement,
|
'announcement' => $announcement,
|
||||||
'users' => User::all(),
|
'users' => User::all(),
|
||||||
'selectedUsersIds' => $announcement->users->pluck('id')->toArray()
|
'selectedUsersIds' => $announcement->users->pluck('id')->toArray(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update(AnnouncementRequest $request, $id){
|
public function update(AnnouncementRequest $request, $id)
|
||||||
|
{
|
||||||
$validatedData = $request->validated();
|
$validatedData = $request->validated();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -97,14 +102,16 @@ public function update(AnnouncementRequest $request, $id){
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("Announcements (update): ". $e);
|
Log::error('Announcements (update): '.$e);
|
||||||
|
|
||||||
return redirect()->back()->with('failed-status', 'Gagal mengubah pengumuman.');
|
return redirect()->back()->with('failed-status', 'Gagal mengubah pengumuman.');
|
||||||
}
|
}
|
||||||
|
|
||||||
return redirect()->route('dashboard.announcements.show', ['id' => encrypt_id($announcement->id)])->with('success-status', 'Berhasil mengubah pengumuman.');
|
return redirect()->route('dashboard.announcements.show', ['id' => encrypt_id($announcement->id)])->with('success-status', 'Berhasil mengubah pengumuman.');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function show($id){
|
public function show($id)
|
||||||
|
{
|
||||||
$announcement = Announcement::with(['users' => function ($query) {
|
$announcement = Announcement::with(['users' => function ($query) {
|
||||||
$query->withPivot('category');
|
$query->withPivot('category');
|
||||||
}])->findOrFail(decrypt_id($id));
|
}])->findOrFail(decrypt_id($id));
|
||||||
@ -115,20 +122,23 @@ public function show($id){
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function destroy($id){
|
public function destroy($id)
|
||||||
|
{
|
||||||
try {
|
try {
|
||||||
$announcement = Announcement::with(['users'])->findOrFail(decrypt_id($id));
|
$announcement = Announcement::with(['users'])->findOrFail(decrypt_id($id));
|
||||||
$announcement->users()->detach();
|
$announcement->users()->detach();
|
||||||
$announcement->delete();
|
$announcement->delete();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("Announcements (destroy): ". $e);
|
Log::error('Announcements (destroy): '.$e);
|
||||||
|
|
||||||
return response()->json(['message' => 'Gagal menghapus pengumuman.'], 500);
|
return response()->json(['message' => 'Gagal menghapus pengumuman.'], 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
return response()->json(['message' => 'Berhasil menghapus pengumuman.']);
|
return response()->json(['message' => 'Berhasil menghapus pengumuman.']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function read($id){
|
public function read($id)
|
||||||
|
{
|
||||||
$announcement = Announcement::with(['users'])->findOrFail(decrypt_id($id));
|
$announcement = Announcement::with(['users'])->findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
if (! in_array(Auth::id(), $announcement->users->pluck('id')->toArray())) {
|
if (! in_array(Auth::id(), $announcement->users->pluck('id')->toArray())) {
|
||||||
@ -140,7 +150,8 @@ public function read($id){
|
|||||||
'status' => '1',
|
'status' => '1',
|
||||||
]);
|
]);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("Announcements (read): ". $e);
|
Log::error('Announcements (read): '.$e);
|
||||||
|
|
||||||
return redirect()->back()->with('failed-status', 'Gagal membaca pengumuman.');
|
return redirect()->back()->with('failed-status', 'Gagal membaca pengumuman.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -5,15 +5,13 @@
|
|||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Http\Requests\ClassificationRequest;
|
use App\Http\Requests\ClassificationRequest;
|
||||||
use App\Models\Classification;
|
use App\Models\Classification;
|
||||||
use Exception;
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Auth;
|
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use Illuminate\Support\Str;
|
|
||||||
|
|
||||||
class ClassificationController extends Controller
|
class ClassificationController extends Controller
|
||||||
{
|
{
|
||||||
public function index(Request $request){
|
public function index(Request $request)
|
||||||
|
{
|
||||||
return view('dashboard.classifications.index', [
|
return view('dashboard.classifications.index', [
|
||||||
'title' => 'Data Klasifikasi',
|
'title' => 'Data Klasifikasi',
|
||||||
'filter' => $request->input('filter', null),
|
'filter' => $request->input('filter', null),
|
||||||
@ -21,19 +19,22 @@ public function index(Request $request){
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function create(){
|
public function create()
|
||||||
|
{
|
||||||
return view('dashboard.classifications.create', [
|
return view('dashboard.classifications.create', [
|
||||||
'title' => 'Buat Klasifikasi Baru'
|
'title' => 'Buat Klasifikasi Baru',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function store(ClassificationRequest $request){
|
public function store(ClassificationRequest $request)
|
||||||
|
{
|
||||||
$validatedData = $request->validated();
|
$validatedData = $request->validated();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$createdClassification = Classification::create($validatedData);
|
$createdClassification = Classification::create($validatedData);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("Classifications (store): ". $e);
|
Log::error('Classifications (store): '.$e);
|
||||||
|
|
||||||
return redirect()->back()->with('failed-status', 'Gagal membuat klasifikasi baru.');
|
return redirect()->back()->with('failed-status', 'Gagal membuat klasifikasi baru.');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,35 +42,39 @@ public function store(ClassificationRequest $request){
|
|||||||
->with('new_data', encrypt_id($createdClassification->id));
|
->with('new_data', encrypt_id($createdClassification->id));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function edit($id){
|
public function edit($id)
|
||||||
|
{
|
||||||
$classification = Classification::findOrFail(decrypt_id($id));
|
$classification = Classification::findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
return view('dashboard.classifications.edit', [
|
return view('dashboard.classifications.edit', [
|
||||||
'title' => 'Ubah Klasifikasi',
|
'title' => 'Ubah Klasifikasi',
|
||||||
'classification' => $classification
|
'classification' => $classification,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update(ClassificationRequest $request, $id){
|
public function update(ClassificationRequest $request, $id)
|
||||||
|
{
|
||||||
$validatedData = $request->validated();
|
$validatedData = $request->validated();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$classification = Classification::findOrFail(decrypt_id($id));
|
$classification = Classification::findOrFail(decrypt_id($id));
|
||||||
$classification->update($validatedData);
|
$classification->update($validatedData);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("Classifications (update): ". $e);
|
Log::error('Classifications (update): '.$e);
|
||||||
|
|
||||||
return redirect()->back()->with('failed-status', 'Gagal mengubah klasifikasi.');
|
return redirect()->back()->with('failed-status', 'Gagal mengubah klasifikasi.');
|
||||||
}
|
}
|
||||||
|
|
||||||
return redirect()->route('dashboard.classifications.show', ['id' => encrypt_id($classification->id)])->with('success-status', 'Berhasil mengubah klasifikasi.');
|
return redirect()->route('dashboard.classifications.show', ['id' => encrypt_id($classification->id)])->with('success-status', 'Berhasil mengubah klasifikasi.');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function show($id){
|
public function show($id)
|
||||||
|
{
|
||||||
$classification = Classification::withTrashed()->findOrFail(decrypt_id($id));
|
$classification = Classification::withTrashed()->findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
return view('dashboard.classifications.show', [
|
return view('dashboard.classifications.show', [
|
||||||
'title' => 'Detail Klasifikasi',
|
'title' => 'Detail Klasifikasi',
|
||||||
'classification' => $classification
|
'classification' => $classification,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,7 +84,8 @@ public function destroy($id)
|
|||||||
$classification = Classification::findOrFail(decrypt_id($id));
|
$classification = Classification::findOrFail(decrypt_id($id));
|
||||||
$classification->delete();
|
$classification->delete();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("Classifications (destroy): ". $e);
|
Log::error('Classifications (destroy): '.$e);
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status' => 'failed',
|
'status' => 'failed',
|
||||||
'message' => 'Gagal menghapus klasifikasi.',
|
'message' => 'Gagal menghapus klasifikasi.',
|
||||||
@ -107,7 +113,8 @@ public function restore($id)
|
|||||||
|
|
||||||
$classification->restore();
|
$classification->restore();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("Classifications (restore): ". $e);
|
Log::error('Classifications (restore): '.$e);
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status' => 'failed',
|
'status' => 'failed',
|
||||||
'message' => 'Gagal mengembalikan klasifikasi.',
|
'message' => 'Gagal mengembalikan klasifikasi.',
|
||||||
@ -119,6 +126,4 @@ public function restore($id)
|
|||||||
'message' => 'Klasifikasi berhasil dikembalikan.',
|
'message' => 'Klasifikasi berhasil dikembalikan.',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,7 +21,8 @@
|
|||||||
|
|
||||||
class CompanyController extends Controller
|
class CompanyController extends Controller
|
||||||
{
|
{
|
||||||
public function index(Request $request){
|
public function index(Request $request)
|
||||||
|
{
|
||||||
if (is_role(['1', '5'])) {
|
if (is_role(['1', '5'])) {
|
||||||
return view('dashboard.companies.admin.index', [
|
return view('dashboard.companies.admin.index', [
|
||||||
'title' => 'Data Perusahaan',
|
'title' => 'Data Perusahaan',
|
||||||
@ -44,17 +45,19 @@ public function index(Request $request){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function editRequest(){
|
public function editRequest()
|
||||||
|
{
|
||||||
if (! in_array(Auth::user()->company->edit_status, ['0', '2', '3'])) {
|
if (! in_array(Auth::user()->company->edit_status, ['0', '2', '3'])) {
|
||||||
abort(404);
|
abort(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
return view('dashboard.companies.edit-request', [
|
return view('dashboard.companies.edit-request', [
|
||||||
'title' => 'Permohonan Ubah Data Perusahaan'
|
'title' => 'Permohonan Ubah Data Perusahaan',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function editRequestAction(Request $request){
|
public function editRequestAction(Request $request)
|
||||||
|
{
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (! in_array(Auth::user()->company->edit_status, ['0', '2', '3'])) {
|
if (! in_array(Auth::user()->company->edit_status, ['0', '2', '3'])) {
|
||||||
@ -70,18 +73,20 @@ public function editRequestAction(Request $request){
|
|||||||
$user = User::with(['company'])->findOrFail(Auth::id());
|
$user = User::with(['company'])->findOrFail(Auth::id());
|
||||||
$user->company->update([
|
$user->company->update([
|
||||||
'edit_status' => '1',
|
'edit_status' => '1',
|
||||||
'edit_description' => $validatedData['edit_description']
|
'edit_description' => $validatedData['edit_description'],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("Company (editRequestAction): ". $e);
|
Log::error('Company (editRequestAction): '.$e);
|
||||||
|
|
||||||
return redirect()->route('dashboard.companies.index')->with('failed-status', 'Gagal melakukan permohonan edit data perusahaan.');
|
return redirect()->route('dashboard.companies.index')->with('failed-status', 'Gagal melakukan permohonan edit data perusahaan.');
|
||||||
}
|
}
|
||||||
|
|
||||||
return redirect()->route('dashboard.companies.index')->with('success-status', 'Berhasil melakukan permohonan edit data perusahaan.');
|
return redirect()->route('dashboard.companies.index')->with('success-status', 'Berhasil melakukan permohonan edit data perusahaan.');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function edit(){
|
public function edit()
|
||||||
|
{
|
||||||
if (Auth::user()->company->edit_status !== '2') {
|
if (Auth::user()->company->edit_status !== '2') {
|
||||||
abort(404);
|
abort(404);
|
||||||
}
|
}
|
||||||
@ -90,11 +95,12 @@ public function edit(){
|
|||||||
|
|
||||||
return view('dashboard.companies.edit', [
|
return view('dashboard.companies.edit', [
|
||||||
'title' => 'Ubah Data Perusahaan',
|
'title' => 'Ubah Data Perusahaan',
|
||||||
'user' => $user
|
'user' => $user,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update(CompanyRequest $request){
|
public function update(CompanyRequest $request)
|
||||||
|
{
|
||||||
|
|
||||||
$validatedData = $request->validated();
|
$validatedData = $request->validated();
|
||||||
|
|
||||||
@ -155,14 +161,16 @@ public function update(CompanyRequest $request){
|
|||||||
});
|
});
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("Company (update): ". $e);
|
Log::error('Company (update): '.$e);
|
||||||
|
|
||||||
return redirect()->route('dashboard.companies.index')->with('failed-status', 'Gagal mengubah data perusahaan.');
|
return redirect()->route('dashboard.companies.index')->with('failed-status', 'Gagal mengubah data perusahaan.');
|
||||||
}
|
}
|
||||||
|
|
||||||
return redirect()->route('dashboard.companies.index')->with('success-status', 'Berhasil mengubah data perusahaan.');
|
return redirect()->route('dashboard.companies.index')->with('success-status', 'Berhasil mengubah data perusahaan.');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function show($id, $type){
|
public function show($id, $type)
|
||||||
|
{
|
||||||
$user = User::with(['role', 'company.media.journalists'])->findOrFail(decrypt_id($id));
|
$user = User::with(['role', 'company.media.journalists'])->findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
@ -173,7 +181,7 @@ public function show($id, $type){
|
|||||||
'purpose' => 'show',
|
'purpose' => 'show',
|
||||||
'idnPage' => 'perusahaan',
|
'idnPage' => 'perusahaan',
|
||||||
'route' => 'companies',
|
'route' => 'companies',
|
||||||
'type' => $type
|
'type' => $type,
|
||||||
];
|
];
|
||||||
|
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
@ -182,6 +190,7 @@ public function show($id, $type){
|
|||||||
|
|
||||||
case 'login-activities':
|
case 'login-activities':
|
||||||
$data['loginActivities'] = LoginHistory::where('user_id', $user->id)->orderByDesc('id')->simplePaginate(20);
|
$data['loginActivities'] = LoginHistory::where('user_id', $user->id)->orderByDesc('id')->simplePaginate(20);
|
||||||
|
|
||||||
return view('dashboard.users.profiles.login-activity', $data);
|
return view('dashboard.users.profiles.login-activity', $data);
|
||||||
|
|
||||||
case 'company':
|
case 'company':
|
||||||
@ -199,11 +208,12 @@ public function show($id, $type){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function destroy($id){
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status' => 'warning',
|
'status' => 'warning',
|
||||||
'message' => 'Aksi belum tersedia.'
|
'message' => 'Aksi belum tersedia.',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// try{
|
// try{
|
||||||
@ -217,7 +227,8 @@ public function destroy($id){
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
public function process(Request $request, $id, $type){
|
public function process(Request $request, $id, $type)
|
||||||
|
{
|
||||||
$user = User::with(['role', 'company.media.journalists'])->findOrFail(decrypt_id($id));
|
$user = User::with(['role', 'company.media.journalists'])->findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
if ($request->query('category') && ! in_array($request->query('category'), ['account-status', 'edit-request'])) {
|
if ($request->query('category') && ! in_array($request->query('category'), ['account-status', 'edit-request'])) {
|
||||||
@ -233,7 +244,7 @@ public function process(Request $request, $id, $type){
|
|||||||
'idnPage' => 'perusahaan',
|
'idnPage' => 'perusahaan',
|
||||||
'route' => 'companies',
|
'route' => 'companies',
|
||||||
'type' => $type,
|
'type' => $type,
|
||||||
'category' => $request->query('category', null)
|
'category' => $request->query('category', null),
|
||||||
];
|
];
|
||||||
|
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
@ -244,6 +255,7 @@ public function process(Request $request, $id, $type){
|
|||||||
$data['loginActivities'] = LoginHistory::where('user_id', $user->id)
|
$data['loginActivities'] = LoginHistory::where('user_id', $user->id)
|
||||||
->orderByDesc('id')
|
->orderByDesc('id')
|
||||||
->simplePaginate(20);
|
->simplePaginate(20);
|
||||||
|
|
||||||
return view('dashboard.users.profiles.login-activity', $data);
|
return view('dashboard.users.profiles.login-activity', $data);
|
||||||
|
|
||||||
case 'company':
|
case 'company':
|
||||||
@ -260,7 +272,8 @@ public function process(Request $request, $id, $type){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function processAcceptAction(Request $request, $id, $type, $category){
|
public function processAcceptAction(Request $request, $id, $type, $category)
|
||||||
|
{
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$user = User::with(['company'])->findOrFail(decrypt_id($id));
|
$user = User::with(['company'])->findOrFail(decrypt_id($id));
|
||||||
@ -272,25 +285,27 @@ public function processAcceptAction(Request $request, $id, $type, $category){
|
|||||||
if (is_role(['1']) && in_array($category, ['account-status', 'edit-request'])) {
|
if (is_role(['1']) && in_array($category, ['account-status', 'edit-request'])) {
|
||||||
if ($category === 'account-status' && $user->status === '0') {
|
if ($category === 'account-status' && $user->status === '0') {
|
||||||
$user->update([
|
$user->update([
|
||||||
'status' => '1'
|
'status' => '1',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
Mail::to($user->email)->send(new AccountVerification($user, 'accepted'));
|
Mail::to($user->email)->send(new AccountVerification($user, 'accepted'));
|
||||||
} elseif ($category === 'edit-request' && $user->company->edit_status === '1') {
|
} elseif ($category === 'edit-request' && $user->company->edit_status === '1') {
|
||||||
$user->company->update([
|
$user->company->update([
|
||||||
'edit_status' => '2'
|
'edit_status' => '2',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("Company (processAcceptAction): ". $e);
|
Log::error('Company (processAcceptAction): '.$e);
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'failed-status' => 'Gagal menyetujui'.($category === 'edit-request' ? ' permohonan edit' : '').' perusahaan.'
|
'failed-status' => 'Gagal menyetujui'.($category === 'edit-request' ? ' permohonan edit' : '').' perusahaan.',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function processRejectAction(Request $request, $id, $type, $category){
|
public function processRejectAction(Request $request, $id, $type, $category)
|
||||||
|
{
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$user = User::with(['company'])->findOrFail(decrypt_id($id));
|
$user = User::with(['company'])->findOrFail(decrypt_id($id));
|
||||||
@ -309,23 +324,24 @@ public function processRejectAction(Request $request, $id, $type, $category){
|
|||||||
|
|
||||||
if ($category === 'account-status' && $user->status === '0') {
|
if ($category === 'account-status' && $user->status === '0') {
|
||||||
$user->update([
|
$user->update([
|
||||||
'status' => '2'
|
'status' => '2',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$user->company->update([
|
$user->company->update([
|
||||||
'rejection_reason' => $validatedData['rejection_reason']
|
'rejection_reason' => $validatedData['rejection_reason'],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
Mail::to($user->email)->send(new AccountVerification($user, 'rejected', $validatedData['rejection_reason']));
|
Mail::to($user->email)->send(new AccountVerification($user, 'rejected', $validatedData['rejection_reason']));
|
||||||
} elseif ($category === 'edit-request' && $user->company->edit_status === '1') {
|
} elseif ($category === 'edit-request' && $user->company->edit_status === '1') {
|
||||||
$user->company->update([
|
$user->company->update([
|
||||||
'edit_status' => '3',
|
'edit_status' => '3',
|
||||||
'edit_rejection_reason' => $validatedData['rejection_reason']
|
'edit_rejection_reason' => $validatedData['rejection_reason'],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("Company (processRejectAction): ". $e);
|
Log::error('Company (processRejectAction): '.$e);
|
||||||
|
|
||||||
return redirect()->back()->with('faileds-status', 'Gagal melakukan proses.');
|
return redirect()->back()->with('faileds-status', 'Gagal melakukan proses.');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -347,12 +363,14 @@ public function export(Request $request)
|
|||||||
|
|
||||||
return Excel::download(new CompanyExport($status, $edit_status, $address, $register_year, $register_month, $register_date), 'companies-'.$formattedNow.'.xlsx');
|
return Excel::download(new CompanyExport($status, $edit_status, $address, $register_year, $register_month, $register_date), 'companies-'.$formattedNow.'.xlsx');
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("Company (export): ". $e);
|
Log::error('Company (export): '.$e);
|
||||||
|
|
||||||
return redirect()->back()->with('failed-status', 'Gagal melakukan export data.');
|
return redirect()->back()->with('failed-status', 'Gagal melakukan export data.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function filter(Request $request){
|
public function filter(Request $request)
|
||||||
|
{
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$filteredRequest = $request->except('_token');
|
$filteredRequest = $request->except('_token');
|
||||||
@ -360,15 +378,18 @@ public function filter(Request $request){
|
|||||||
$filterField = array_filter($filteredRequest, function ($value) {
|
$filterField = array_filter($filteredRequest, function ($value) {
|
||||||
return filled($value);
|
return filled($value);
|
||||||
});
|
});
|
||||||
|
|
||||||
return redirect()->route('dashboard.companies.index', $filterField);
|
return redirect()->route('dashboard.companies.index', $filterField);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("Company (filter): ". $e);
|
Log::error('Company (filter): '.$e);
|
||||||
|
|
||||||
return redirect()->back()->with('failed-status', 'Gagal melakukan filter data.');
|
return redirect()->back()->with('failed-status', 'Gagal melakukan filter data.');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function printData($id){
|
public function printData($id)
|
||||||
|
{
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$company = Company::with(['user.role'])->findOrFail(decrypt_id($id));
|
$company = Company::with(['user.role'])->findOrFail(decrypt_id($id));
|
||||||
@ -377,7 +398,8 @@ public function printData($id){
|
|||||||
|
|
||||||
return $pdf->stream('perusahaan-'.slugify($company->name).'.pdf');
|
return $pdf->stream('perusahaan-'.slugify($company->name).'.pdf');
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("Company (printData): ". $e);
|
Log::error('Company (printData): '.$e);
|
||||||
|
|
||||||
return redirect()->back()->with('failed-status', 'Gagal melakukan print data.');
|
return redirect()->back()->with('failed-status', 'Gagal melakukan print data.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,38 +3,41 @@
|
|||||||
namespace App\Http\Controllers\Dashboard;
|
namespace App\Http\Controllers\Dashboard;
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Http\Requests\ReceiveMessageContactRequest;
|
|
||||||
use App\Models\Contact;
|
use App\Models\Contact;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
class ContactController extends Controller
|
class ContactController extends Controller
|
||||||
{
|
{
|
||||||
public function index(Request $request){
|
public function index(Request $request)
|
||||||
|
{
|
||||||
return view('dashboard.contacts.index', [
|
return view('dashboard.contacts.index', [
|
||||||
'title' => 'Pesan Kontak',
|
'title' => 'Pesan Kontak',
|
||||||
'status' => $request->input('status', null)
|
'status' => $request->input('status', null),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function show($id){
|
public function show($id)
|
||||||
|
{
|
||||||
$contact = Contact::findOrFail(decrypt_id($id));
|
$contact = Contact::findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
return view('dashboard.contacts.show', [
|
return view('dashboard.contacts.show', [
|
||||||
'title' => 'Detail Pesan',
|
'title' => 'Detail Pesan',
|
||||||
'contact' => $contact
|
'contact' => $contact,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function reply($id){
|
public function reply($id)
|
||||||
|
{
|
||||||
$contact = Contact::findOrFail(decrypt_id($id));
|
$contact = Contact::findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
return view('dashboard.contacts.reply', [
|
return view('dashboard.contacts.reply', [
|
||||||
'title' => 'Balas Pesan',
|
'title' => 'Balas Pesan',
|
||||||
'contact' => $contact
|
'contact' => $contact,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function replyAction(Request $request, $id){
|
public function replyAction(Request $request, $id)
|
||||||
|
{
|
||||||
$validatedData = $request->validate([
|
$validatedData = $request->validate([
|
||||||
'reply_message' => ['required'],
|
'reply_message' => ['required'],
|
||||||
], [
|
], [
|
||||||
@ -45,13 +48,14 @@ public function replyAction(Request $request, $id){
|
|||||||
|
|
||||||
$contact->update([
|
$contact->update([
|
||||||
'reply_message' => $validatedData['reply_message'],
|
'reply_message' => $validatedData['reply_message'],
|
||||||
'status' => '1'
|
'status' => '1',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return redirect()->route('dashboard.contact.messages.show', ['id' => encrypt_id($contact->id)])->with('success-status', 'Berhasil membalas pesan.');
|
return redirect()->route('dashboard.contact.messages.show', ['id' => encrypt_id($contact->id)])->with('success-status', 'Berhasil membalas pesan.');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function destroy($id){
|
public function destroy($id)
|
||||||
|
{
|
||||||
try {
|
try {
|
||||||
$contact = Contact::findOrFail(decrypt_id($id));
|
$contact = Contact::findOrFail(decrypt_id($id));
|
||||||
$contact->delete();
|
$contact->delete();
|
||||||
|
|||||||
@ -4,28 +4,27 @@
|
|||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Http\Requests\ContentRecapClassificationRequest;
|
use App\Http\Requests\ContentRecapClassificationRequest;
|
||||||
use App\Models\ContentRecap;
|
|
||||||
use App\Models\ContentRecapClassification;
|
use App\Models\ContentRecapClassification;
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Support\Facades\Auth;
|
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use Illuminate\Support\Str;
|
|
||||||
|
|
||||||
class ContentRecapClassificationController extends Controller
|
class ContentRecapClassificationController extends Controller
|
||||||
{
|
{
|
||||||
public function index(){
|
public function index()
|
||||||
|
{
|
||||||
return view('dashboard.content-recaps.classifications.index', [
|
return view('dashboard.content-recaps.classifications.index', [
|
||||||
'title' => "Klasifikasi Rekap Konten"
|
'title' => 'Klasifikasi Rekap Konten',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function create(){
|
public function create()
|
||||||
|
{
|
||||||
return view('dashboard.content-recaps.classifications.create', [
|
return view('dashboard.content-recaps.classifications.create', [
|
||||||
'title' => "Buat Klasifikasi Rekap Konten Baru"
|
'title' => 'Buat Klasifikasi Rekap Konten Baru',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function store(ContentRecapClassificationRequest $request){
|
public function store(ContentRecapClassificationRequest $request)
|
||||||
|
{
|
||||||
$validatedData = $request->validated();
|
$validatedData = $request->validated();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -39,7 +38,8 @@ public function store(ContentRecapClassificationRequest $request){
|
|||||||
|
|
||||||
$createdClassification = ContentRecapClassification::create($validatedData);
|
$createdClassification = ContentRecapClassification::create($validatedData);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("ContentRecapClassifications (store): ". $e);
|
Log::error('ContentRecapClassifications (store): '.$e);
|
||||||
|
|
||||||
return redirect()->back()->with('failed-status', 'Gagal menambahkan klasifikasi rekap konten.');
|
return redirect()->back()->with('failed-status', 'Gagal menambahkan klasifikasi rekap konten.');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,45 +47,52 @@ public function store(ContentRecapClassificationRequest $request){
|
|||||||
->with('new_data', encrypt_id($createdClassification->id));
|
->with('new_data', encrypt_id($createdClassification->id));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function edit($id){
|
public function edit($id)
|
||||||
|
{
|
||||||
$contentRecapClassification = ContentRecapClassification::findOrFail(decrypt_id($id));
|
$contentRecapClassification = ContentRecapClassification::findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
return view('dashboard.content-recaps.classifications.edit', [
|
return view('dashboard.content-recaps.classifications.edit', [
|
||||||
'title' => "Ubah Klasifikasi Rekap Konten",
|
'title' => 'Ubah Klasifikasi Rekap Konten',
|
||||||
'contentRecapClassification' => $contentRecapClassification
|
'contentRecapClassification' => $contentRecapClassification,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update(ContentRecapClassificationRequest $request, $id){
|
public function update(ContentRecapClassificationRequest $request, $id)
|
||||||
|
{
|
||||||
$validatedData = $request->validated();
|
$validatedData = $request->validated();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$contentRecapClassification = ContentRecapClassification::findOrFail(decrypt_id($id));
|
$contentRecapClassification = ContentRecapClassification::findOrFail(decrypt_id($id));
|
||||||
$contentRecapClassification->update($validatedData);
|
$contentRecapClassification->update($validatedData);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("ContentRecapClassifications (update): ". $e);
|
Log::error('ContentRecapClassifications (update): '.$e);
|
||||||
|
|
||||||
return redirect()->back()->with('failed-status', 'Gagal mengubah klasifikasi rekap konten.');
|
return redirect()->back()->with('failed-status', 'Gagal mengubah klasifikasi rekap konten.');
|
||||||
}
|
}
|
||||||
|
|
||||||
return redirect()->route('dashboard.content.recap.classifications.show', ['id' => encrypt_id($contentRecapClassification->id)])->with('success-status', 'Berhasil mengubah klasifikasi rekap konten.');
|
return redirect()->route('dashboard.content.recap.classifications.show', ['id' => encrypt_id($contentRecapClassification->id)])->with('success-status', 'Berhasil mengubah klasifikasi rekap konten.');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function show($id){
|
public function show($id)
|
||||||
|
{
|
||||||
$contentRecapClassification = ContentRecapClassification::findOrFail(decrypt_id($id));
|
$contentRecapClassification = ContentRecapClassification::findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
return view('dashboard.content-recaps.classifications.show', [
|
return view('dashboard.content-recaps.classifications.show', [
|
||||||
'title' => "Detail Klasifikasi Rekap Konten",
|
'title' => 'Detail Klasifikasi Rekap Konten',
|
||||||
'contentRecapClassification' => $contentRecapClassification
|
'contentRecapClassification' => $contentRecapClassification,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function destroy($id){
|
public function destroy($id)
|
||||||
|
{
|
||||||
try {
|
try {
|
||||||
$contentRecapClassification = ContentRecapClassification::findOrFail(decrypt_id($id));
|
$contentRecapClassification = ContentRecapClassification::findOrFail(decrypt_id($id));
|
||||||
$contentRecapClassification->delete();
|
$contentRecapClassification->delete();
|
||||||
|
|
||||||
return response()->json(['message' => 'Berhasil menghapus klasifikasi rekap konten.']);
|
return response()->json(['message' => 'Berhasil menghapus klasifikasi rekap konten.']);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("ContentRecapClassifications (destroy): ". $e);
|
Log::error('ContentRecapClassifications (destroy): '.$e);
|
||||||
|
|
||||||
return response()->json(['message' => 'Gagal menghapus klasifikasi rekap konten.'], 500);
|
return response()->json(['message' => 'Gagal menghapus klasifikasi rekap konten.'], 500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -104,12 +111,14 @@ public function restore($slug)
|
|||||||
|
|
||||||
if (filled($recapContentClassification->deleted_at)) {
|
if (filled($recapContentClassification->deleted_at)) {
|
||||||
$recapContentClassification->restore();
|
$recapContentClassification->restore();
|
||||||
|
|
||||||
return redirect()->back()->with('success-status', 'Klasifikasi berhasil dipulihkan.');
|
return redirect()->back()->with('success-status', 'Klasifikasi berhasil dipulihkan.');
|
||||||
}
|
}
|
||||||
|
|
||||||
return redirect()->back()->with('info-status', 'Klasifikasi sudah aktif.');
|
return redirect()->back()->with('info-status', 'Klasifikasi sudah aktif.');
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("ContentRecapClassifications (restore): ". $e);
|
Log::error('ContentRecapClassifications (restore): '.$e);
|
||||||
|
|
||||||
return redirect()->back()->with('failed-status', 'Gagal melakukan proses pemulihan.');
|
return redirect()->back()->with('failed-status', 'Gagal melakukan proses pemulihan.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,13 +10,13 @@
|
|||||||
use Barryvdh\DomPDF\Facade\Pdf;
|
use Barryvdh\DomPDF\Facade\Pdf;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Auth;
|
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use Maatwebsite\Excel\Facades\Excel;
|
use Maatwebsite\Excel\Facades\Excel;
|
||||||
|
|
||||||
class ContentRecapController extends Controller
|
class ContentRecapController extends Controller
|
||||||
{
|
{
|
||||||
public function index(Request $request){
|
public function index(Request $request)
|
||||||
|
{
|
||||||
return view('dashboard.content-recaps.index', [
|
return view('dashboard.content-recaps.index', [
|
||||||
'title' => 'Rekap Konten',
|
'title' => 'Rekap Konten',
|
||||||
'classifications' => ContentRecapClassification::all(),
|
'classifications' => ContentRecapClassification::all(),
|
||||||
@ -30,14 +30,16 @@ public function index(Request $request){
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function create(){
|
public function create()
|
||||||
|
{
|
||||||
return view('dashboard.content-recaps.create', [
|
return view('dashboard.content-recaps.create', [
|
||||||
'title' => 'Tambah Rekap Konten',
|
'title' => 'Tambah Rekap Konten',
|
||||||
'classifications' => ContentRecapClassification::all()
|
'classifications' => ContentRecapClassification::all(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function store(ContentRecapRequest $request){
|
public function store(ContentRecapRequest $request)
|
||||||
|
{
|
||||||
$validatedData = $request->validated();
|
$validatedData = $request->validated();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -49,7 +51,8 @@ public function store(ContentRecapRequest $request){
|
|||||||
$validatedData['image'] = null;
|
$validatedData['image'] = null;
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("ContentRecaps (store): ". $e);
|
Log::error('ContentRecaps (store): '.$e);
|
||||||
|
|
||||||
return redirect()->back()->with('failed-status', 'Gagal menambahkan rekap konten.');
|
return redirect()->back()->with('failed-status', 'Gagal menambahkan rekap konten.');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,17 +60,19 @@ public function store(ContentRecapRequest $request){
|
|||||||
->with('new_data', encrypt_id($createdContentRecap->id));
|
->with('new_data', encrypt_id($createdContentRecap->id));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function edit($id){
|
public function edit($id)
|
||||||
|
{
|
||||||
$contentRecap = ContentRecap::findOrFail(decrypt_id($id));
|
$contentRecap = ContentRecap::findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
return view('dashboard.content-recaps.edit', [
|
return view('dashboard.content-recaps.edit', [
|
||||||
'title' => 'Ubah Rekap Konten',
|
'title' => 'Ubah Rekap Konten',
|
||||||
'contentRecap' => $contentRecap,
|
'contentRecap' => $contentRecap,
|
||||||
'classifications' => ContentRecapClassification::all()
|
'classifications' => ContentRecapClassification::all(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update(ContentRecapRequest $request, $id){
|
public function update(ContentRecapRequest $request, $id)
|
||||||
|
{
|
||||||
$validatedData = $request->validated();
|
$validatedData = $request->validated();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -81,7 +86,8 @@ public function update(ContentRecapRequest $request, $id){
|
|||||||
|
|
||||||
$contentRecap->update($validatedData);
|
$contentRecap->update($validatedData);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("ContentRecaps (update): ". $e);
|
Log::error('ContentRecaps (update): '.$e);
|
||||||
|
|
||||||
return redirect()->back()->with('failed-status', 'Gagal mengubah rekap konten.');
|
return redirect()->back()->with('failed-status', 'Gagal mengubah rekap konten.');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,22 +95,25 @@ public function update(ContentRecapRequest $request, $id){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function show($id){
|
public function show($id)
|
||||||
|
{
|
||||||
$contentRecap = ContentRecap::findOrFail(decrypt_id($id));
|
$contentRecap = ContentRecap::findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
return view('dashboard.content-recaps.show', [
|
return view('dashboard.content-recaps.show', [
|
||||||
'title' => 'Detail Rekap Konten',
|
'title' => 'Detail Rekap Konten',
|
||||||
'contentRecap' => $contentRecap
|
'contentRecap' => $contentRecap,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function destroy($id){
|
public function destroy($id)
|
||||||
|
{
|
||||||
try {
|
try {
|
||||||
$contentRecap = ContentRecap::findOrFail(decrypt_id($id));
|
$contentRecap = ContentRecap::findOrFail(decrypt_id($id));
|
||||||
$contentRecap->delete();
|
$contentRecap->delete();
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("ContentRecaps (destroy): ". $e);
|
Log::error('ContentRecaps (destroy): '.$e);
|
||||||
|
|
||||||
return response()->json(['message' => 'Gagal menghapus rekap konten.'], 500);
|
return response()->json(['message' => 'Gagal menghapus rekap konten.'], 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,11 +125,12 @@ public function checkLink(Request $request)
|
|||||||
$linkExists = ContentRecap::where('link', $request->link)->exists();
|
$linkExists = ContentRecap::where('link', $request->link)->exists();
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'exists' => $linkExists
|
'exists' => $linkExists,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function filter(Request $request){
|
public function filter(Request $request)
|
||||||
|
{
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$filteredRequest = $request->except('_token');
|
$filteredRequest = $request->except('_token');
|
||||||
@ -129,7 +139,8 @@ public function filter(Request $request){
|
|||||||
return filled($value);
|
return filled($value);
|
||||||
});
|
});
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("ContentRecaps (filter): ". $e);
|
Log::error('ContentRecaps (filter): '.$e);
|
||||||
|
|
||||||
return redirect()->back()->with('failed-status', 'Gagal melakukan filter data.');
|
return redirect()->back()->with('failed-status', 'Gagal melakukan filter data.');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,12 +163,14 @@ public function export(Request $request)
|
|||||||
|
|
||||||
return Excel::download(new ContentRecapExport($classification, $channel, $social_media, $content_type, $posted_year, $posted_month, $posted_date), 'content-recaps-'.$formattedNow.'.xlsx');
|
return Excel::download(new ContentRecapExport($classification, $channel, $social_media, $content_type, $posted_year, $posted_month, $posted_date), 'content-recaps-'.$formattedNow.'.xlsx');
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("ContentRecaps (export): ". $e);
|
Log::error('ContentRecaps (export): '.$e);
|
||||||
|
|
||||||
return redirect()->back()->with('failed-status', 'Gagal melakukan export data.');
|
return redirect()->back()->with('failed-status', 'Gagal melakukan export data.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function printData($id){
|
public function printData($id)
|
||||||
|
{
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$contentRecap = ContentRecap::with(['enhancer', 'classification'])->findOrFail(decrypt_id($id));
|
$contentRecap = ContentRecap::with(['enhancer', 'classification'])->findOrFail(decrypt_id($id));
|
||||||
@ -166,7 +179,8 @@ public function printData($id){
|
|||||||
|
|
||||||
return $pdf->stream(slugify('rekap konten '.$contentRecap->content_theme).'.pdf');
|
return $pdf->stream(slugify('rekap konten '.$contentRecap->content_theme).'.pdf');
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("ContentRecaps (printData): ". $e);
|
Log::error('ContentRecaps (printData): '.$e);
|
||||||
|
|
||||||
return redirect()->back()->with('failed-status', 'Gagal melakukan print data.');
|
return redirect()->back()->with('failed-status', 'Gagal melakukan print data.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,7 +9,8 @@
|
|||||||
|
|
||||||
class CooperationArchiveController extends Controller
|
class CooperationArchiveController extends Controller
|
||||||
{
|
{
|
||||||
public function index(Request $request){
|
public function index(Request $request)
|
||||||
|
{
|
||||||
return view('dashboard.cooperation-archives.index', [
|
return view('dashboard.cooperation-archives.index', [
|
||||||
'title' => 'Arsip Kerja Sama',
|
'title' => 'Arsip Kerja Sama',
|
||||||
'date' => $request->input('date', null),
|
'date' => $request->input('date', null),
|
||||||
@ -33,7 +34,8 @@ public function export(Request $request)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function filter(Request $request){
|
public function filter(Request $request)
|
||||||
|
{
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$filteredRequest = $request->except('_token');
|
$filteredRequest = $request->except('_token');
|
||||||
@ -47,6 +49,5 @@ public function filter(Request $request){
|
|||||||
return redirect()->back()->with('status-failed', 'Gagal melakukan proses filtering data.');
|
return redirect()->back()->with('status-failed', 'Gagal melakukan proses filtering data.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,7 +6,6 @@
|
|||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Http\Requests\CooperationCompletionRequest;
|
use App\Http\Requests\CooperationCompletionRequest;
|
||||||
use App\Models\Announcement;
|
use App\Models\Announcement;
|
||||||
use App\Models\Cooperation;
|
|
||||||
use App\Models\CooperationCompletion;
|
use App\Models\CooperationCompletion;
|
||||||
use App\Models\Media;
|
use App\Models\Media;
|
||||||
use Barryvdh\DomPDF\Facade\Pdf;
|
use Barryvdh\DomPDF\Facade\Pdf;
|
||||||
@ -19,7 +18,8 @@
|
|||||||
class CooperationCompletionController extends Controller
|
class CooperationCompletionController extends Controller
|
||||||
{
|
{
|
||||||
// Main page: Penyelesaian Kerja Sama
|
// Main page: Penyelesaian Kerja Sama
|
||||||
public function index(Request $request){
|
public function index(Request $request)
|
||||||
|
{
|
||||||
return view('dashboard.cooperation-completions.index', [
|
return view('dashboard.cooperation-completions.index', [
|
||||||
'title' => 'Penyelesaian Kerja Sama',
|
'title' => 'Penyelesaian Kerja Sama',
|
||||||
'mediaCollection' => Media::all(),
|
'mediaCollection' => Media::all(),
|
||||||
@ -32,7 +32,8 @@ public function index(Request $request){
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function store(CooperationCompletionRequest $request, $id){
|
public function store(CooperationCompletionRequest $request, $id)
|
||||||
|
{
|
||||||
$validatedData = $request->validated();
|
$validatedData = $request->validated();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -50,61 +51,65 @@ public function store(CooperationCompletionRequest $request, $id){
|
|||||||
$validatedData['other_document'] = null;
|
$validatedData['other_document'] = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$validatedData['order_id'] = decrypt_id($id);
|
$validatedData['order_id'] = decrypt_id($id);
|
||||||
$validatedData['media_id'] = Auth::user()->company->media->id;
|
$validatedData['media_id'] = Auth::user()->company->media->id;
|
||||||
|
|
||||||
CooperationCompletion::create($validatedData);
|
CooperationCompletion::create($validatedData);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("CooperationCompletions (store): ". $e);
|
Log::error('CooperationCompletions (store): '.$e);
|
||||||
|
|
||||||
return redirect()->back()->with('failed-status', 'Gagal mengirim formulir.');
|
return redirect()->back()->with('failed-status', 'Gagal mengirim formulir.');
|
||||||
}
|
}
|
||||||
|
|
||||||
return redirect()->back()->with('success-status', 'Berhasil mengirim formulir.');
|
return redirect()->back()->with('success-status', 'Berhasil mengirim formulir.');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function show($mediaOrderId, $id){
|
public function show($mediaOrderId, $id)
|
||||||
|
{
|
||||||
$cooperationCompletion = CooperationCompletion::findOrFail(decrypt_id($id));
|
$cooperationCompletion = CooperationCompletion::findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
return view('dashboard.cooperation-completions.show', [
|
return view('dashboard.cooperation-completions.show', [
|
||||||
'title' => 'Detail Penyelesaian Kerja Sama',
|
'title' => 'Detail Penyelesaian Kerja Sama',
|
||||||
'cooperationCompletion' => $cooperationCompletion,
|
'cooperationCompletion' => $cooperationCompletion,
|
||||||
'mediaOrderId' => $mediaOrderId
|
'mediaOrderId' => $mediaOrderId,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function showIndex($id){
|
public function showIndex($id)
|
||||||
|
{
|
||||||
$cooperationCompletion = CooperationCompletion::findOrFail(decrypt_id($id));
|
$cooperationCompletion = CooperationCompletion::findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
return view('dashboard.cooperation-completions.index.show', [
|
return view('dashboard.cooperation-completions.index.show', [
|
||||||
'title' => 'Detail Penyelesaian Kerja Sama',
|
'title' => 'Detail Penyelesaian Kerja Sama',
|
||||||
'cooperationCompletion' => $cooperationCompletion
|
'cooperationCompletion' => $cooperationCompletion,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function processIndex($id){
|
public function processIndex($id)
|
||||||
|
{
|
||||||
$cooperationCompletion = CooperationCompletion::findOrFail(decrypt_id($id));
|
$cooperationCompletion = CooperationCompletion::findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
return view('dashboard.cooperation-completions.index.process', [
|
return view('dashboard.cooperation-completions.index.process', [
|
||||||
'title' => 'Detail Penyelesaian Kerja Sama',
|
'title' => 'Detail Penyelesaian Kerja Sama',
|
||||||
'cooperationCompletion' => $cooperationCompletion
|
'cooperationCompletion' => $cooperationCompletion,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function accept($id){
|
public function accept($id)
|
||||||
|
{
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$completion = CooperationCompletion::with(['order', 'media'])->findOrFail(decrypt_id($id));
|
$completion = CooperationCompletion::with(['order', 'media'])->findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
$completion->update([
|
$completion->update([
|
||||||
'status' => '1'
|
'status' => '1',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Announcements
|
// Announcements
|
||||||
$announcementData = [
|
$announcementData = [
|
||||||
'headline' => 'Formulir penyelesaian kerja sama <u>'.$completion->order->cooperation->name.'</u> telah <span class="text-primary">disetujui</span>',
|
'headline' => 'Formulir penyelesaian kerja sama <u>'.$completion->order->cooperation->name.'</u> telah <span class="text-primary">disetujui</span>',
|
||||||
'content' => '<p>Admin telah menyetujui laporan formulir penyelesaian kerja sama Anda.</p>',
|
'content' => '<p>Admin telah menyetujui laporan formulir penyelesaian kerja sama Anda.</p>',
|
||||||
'enhancer_id' => Auth::id()
|
'enhancer_id' => Auth::id(),
|
||||||
];
|
];
|
||||||
|
|
||||||
$createdAnnouncement = Announcement::create($announcementData);
|
$createdAnnouncement = Announcement::create($announcementData);
|
||||||
@ -112,7 +117,8 @@ public function accept($id){
|
|||||||
// End Announcements
|
// End Announcements
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("CooperationCompletions (accept): ". $e);
|
Log::error('CooperationCompletions (accept): '.$e);
|
||||||
|
|
||||||
return redirect()->back()->with('failed-status', 'Gagal menyetujui penyelesaian kerja sama');
|
return redirect()->back()->with('failed-status', 'Gagal menyetujui penyelesaian kerja sama');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,17 +126,19 @@ public function accept($id){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function reject($mediaOrderId, $id){
|
public function reject($mediaOrderId, $id)
|
||||||
|
{
|
||||||
$cooperationCompletion = CooperationCompletion::findOrFail(decrypt_id($id));
|
$cooperationCompletion = CooperationCompletion::findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
return view('dashboard.cooperation-completions.reject', [
|
return view('dashboard.cooperation-completions.reject', [
|
||||||
'title' => 'Tolak Penyelesaian Kerja Sama',
|
'title' => 'Tolak Penyelesaian Kerja Sama',
|
||||||
'cooperationCompletion' => $cooperationCompletion,
|
'cooperationCompletion' => $cooperationCompletion,
|
||||||
'mediaOrderId' => $mediaOrderId
|
'mediaOrderId' => $mediaOrderId,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function rejectAction(Request $request, $mediaOrderId, $id){
|
public function rejectAction(Request $request, $mediaOrderId, $id)
|
||||||
|
{
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$validatedData = $request->validate([
|
$validatedData = $request->validate([
|
||||||
@ -143,21 +151,22 @@ public function rejectAction(Request $request, $mediaOrderId, $id){
|
|||||||
|
|
||||||
$completion->update([
|
$completion->update([
|
||||||
'status' => '2',
|
'status' => '2',
|
||||||
'rejection_reason' => $validatedData['rejection_reason']
|
'rejection_reason' => $validatedData['rejection_reason'],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Announcements
|
// Announcements
|
||||||
$announcementData = [
|
$announcementData = [
|
||||||
'headline' => 'Formulir penyelesaian kerja sama <u>'.$completion->order->cooperation->name.'</u> telah <span class="text-danger">ditolak</span>',
|
'headline' => 'Formulir penyelesaian kerja sama <u>'.$completion->order->cooperation->name.'</u> telah <span class="text-danger">ditolak</span>',
|
||||||
'content' => '<p>Admin telah menolak laporan formulir penyelesaian kerja sama Anda.</p>',
|
'content' => '<p>Admin telah menolak laporan formulir penyelesaian kerja sama Anda.</p>',
|
||||||
'enhancer_id' => Auth::id()
|
'enhancer_id' => Auth::id(),
|
||||||
];
|
];
|
||||||
$createdAnnouncement = Announcement::create($announcementData);
|
$createdAnnouncement = Announcement::create($announcementData);
|
||||||
$createdAnnouncement->users()->attach($completion->media->company->user->id, ['category' => 'system']);
|
$createdAnnouncement->users()->attach($completion->media->company->user->id, ['category' => 'system']);
|
||||||
// End Announcements
|
// End Announcements
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("CooperationCompletions (rejectAction): ". $e);
|
Log::error('CooperationCompletions (rejectAction): '.$e);
|
||||||
|
|
||||||
return redirect()->back()->with('failed-status', 'Gagal menolak penyelesaian kerja sama');
|
return redirect()->back()->with('failed-status', 'Gagal menolak penyelesaian kerja sama');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,7 +174,8 @@ public function rejectAction(Request $request, $mediaOrderId, $id){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function rejectActionIndex(Request $request, $id){
|
public function rejectActionIndex(Request $request, $id)
|
||||||
|
{
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$validatedData = $request->validate([
|
$validatedData = $request->validate([
|
||||||
@ -178,21 +188,22 @@ public function rejectActionIndex(Request $request, $id){
|
|||||||
|
|
||||||
$completion->update([
|
$completion->update([
|
||||||
'status' => '2',
|
'status' => '2',
|
||||||
'rejection_reason' => $validatedData['rejection_reason']
|
'rejection_reason' => $validatedData['rejection_reason'],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Announcements
|
// Announcements
|
||||||
$announcementData = [
|
$announcementData = [
|
||||||
'headline' => 'Formulir penyelesaian kerja sama <u>'.$completion->order->cooperation->name.'</u> telah <span class="text-danger">ditolak</span>',
|
'headline' => 'Formulir penyelesaian kerja sama <u>'.$completion->order->cooperation->name.'</u> telah <span class="text-danger">ditolak</span>',
|
||||||
'content' => '<p>Admin telah menolak laporan formulir penyelesaian kerja sama Anda.</p>',
|
'content' => '<p>Admin telah menolak laporan formulir penyelesaian kerja sama Anda.</p>',
|
||||||
'enhancer_id' => Auth::id()
|
'enhancer_id' => Auth::id(),
|
||||||
];
|
];
|
||||||
$createdAnnouncement = Announcement::create($announcementData);
|
$createdAnnouncement = Announcement::create($announcementData);
|
||||||
$createdAnnouncement->users()->attach($completion->media->company->user->id, ['category' => 'system']);
|
$createdAnnouncement->users()->attach($completion->media->company->user->id, ['category' => 'system']);
|
||||||
// End Announcements
|
// End Announcements
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("CooperationCompletions (rejectAction): ". $e);
|
Log::error('CooperationCompletions (rejectAction): '.$e);
|
||||||
|
|
||||||
return redirect()->back()->with('failed-status', 'Gagal menolak penyelesaian kerja sama');
|
return redirect()->back()->with('failed-status', 'Gagal menolak penyelesaian kerja sama');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -214,6 +225,7 @@ public function export(Request $request)
|
|||||||
|
|
||||||
if ($export_type === 'excel') {
|
if ($export_type === 'excel') {
|
||||||
$formattedNow = Carbon::parse(now())->locale('id')->translatedFormat('d-m-Y');
|
$formattedNow = Carbon::parse(now())->locale('id')->translatedFormat('d-m-Y');
|
||||||
|
|
||||||
return Excel::download(new CooperationCompletionExport($media, $status, $year, $from_month, $to_month, $date), 'reports-'.$formattedNow.'.xlsx');
|
return Excel::download(new CooperationCompletionExport($media, $status, $year, $from_month, $to_month, $date), 'reports-'.$formattedNow.'.xlsx');
|
||||||
} elseif ($export_type === 'pdf') {
|
} elseif ($export_type === 'pdf') {
|
||||||
if (is_role(['1', '5'])) {
|
if (is_role(['1', '5'])) {
|
||||||
@ -269,14 +281,14 @@ public function export(Request $request)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function singlePrint(){
|
public function singlePrint()
|
||||||
|
{
|
||||||
try {
|
try {
|
||||||
$cooperationCompletion = CooperationCompletion::with(['media.company'])->first();
|
$cooperationCompletion = CooperationCompletion::with(['media.company'])->first();
|
||||||
// dd('hai');
|
// dd('hai');
|
||||||
|
|
||||||
$pdf = Pdf::loadView('dashboard.cooperation-completions.prints.single', compact('cooperationCompletion'));
|
$pdf = Pdf::loadView('dashboard.cooperation-completions.prints.single', compact('cooperationCompletion'));
|
||||||
|
|
||||||
|
|
||||||
return $pdf->stream(slugify('Penyelesaian kerja sama '.$cooperationCompletion->media->name).'.pdf');
|
return $pdf->stream(slugify('Penyelesaian kerja sama '.$cooperationCompletion->media->name).'.pdf');
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return redirect()->back()->with('failed-status', 'Gagal melakukan proses print data.');
|
return redirect()->back()->with('failed-status', 'Gagal melakukan proses print data.');
|
||||||
|
|||||||
@ -14,13 +14,15 @@
|
|||||||
|
|
||||||
class CooperationRequestController extends Controller
|
class CooperationRequestController extends Controller
|
||||||
{
|
{
|
||||||
public function index(){
|
public function index()
|
||||||
|
{
|
||||||
return view('dashboard.cooperation-requests.index', [
|
return view('dashboard.cooperation-requests.index', [
|
||||||
'title' => 'Ajuan Kerja Sama'
|
'title' => 'Ajuan Kerja Sama',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function show($id){
|
public function show($id)
|
||||||
|
{
|
||||||
$cooperation = Cooperation::with(['media'])->findOrFail(decrypt_id($id));
|
$cooperation = Cooperation::with(['media'])->findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
$mediaCooperationPivot = $cooperation->media()
|
$mediaCooperationPivot = $cooperation->media()
|
||||||
@ -30,26 +32,29 @@ public function show($id){
|
|||||||
return view('dashboard.cooperation-requests.show', [
|
return view('dashboard.cooperation-requests.show', [
|
||||||
'title' => 'Tolak Kerja Sama',
|
'title' => 'Tolak Kerja Sama',
|
||||||
'cooperation' => $cooperation,
|
'cooperation' => $cooperation,
|
||||||
'mediaCooperationPivot' => $mediaCooperationPivot
|
'mediaCooperationPivot' => $mediaCooperationPivot,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function mediaProposal(){
|
public function mediaProposal()
|
||||||
|
{
|
||||||
return view('dashboard.cooperation-requests.media-proposals.index', [
|
return view('dashboard.cooperation-requests.media-proposals.index', [
|
||||||
'title' => 'Ajuan Kerja Sama Saya'
|
'title' => 'Ajuan Kerja Sama Saya',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function mediaProposalShow($id){
|
public function mediaProposalShow($id)
|
||||||
|
{
|
||||||
$proposal = CooperationProposal::with(['cooperation', 'media', 'journalists'])->findOrFail(decrypt_id($id));
|
$proposal = CooperationProposal::with(['cooperation', 'media', 'journalists'])->findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
return view('dashboard.cooperation-requests.media-proposals.show', [
|
return view('dashboard.cooperation-requests.media-proposals.show', [
|
||||||
'title' => 'Detail Ajuan Kerja Sama',
|
'title' => 'Detail Ajuan Kerja Sama',
|
||||||
'proposal' => $proposal
|
'proposal' => $proposal,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function accept(Request $request, $id){
|
public function accept(Request $request, $id)
|
||||||
|
{
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (! Auth::check() || Auth::user()->role_id !== 3) {
|
if (! Auth::check() || Auth::user()->role_id !== 3) {
|
||||||
@ -76,7 +81,7 @@ public function accept(Request $request, $id){
|
|||||||
$announcementData = [
|
$announcementData = [
|
||||||
'headline' => 'Ajuan Kerja Sama <u>'.$cooperation->name.'</u> <span class="text-primary">diterima</span> oleh media <u>'.$mediaCooperation->name.'</u>',
|
'headline' => 'Ajuan Kerja Sama <u>'.$cooperation->name.'</u> <span class="text-primary">diterima</span> oleh media <u>'.$mediaCooperation->name.'</u>',
|
||||||
'content' => '<p>Ajuan Kerja Sama <u>'.$cooperation->name.'</u> telah <span class="text-primary">diterima</span> oleh media <u>'.$mediaCooperation->name.'</u></p>',
|
'content' => '<p>Ajuan Kerja Sama <u>'.$cooperation->name.'</u> telah <span class="text-primary">diterima</span> oleh media <u>'.$mediaCooperation->name.'</u></p>',
|
||||||
'enhancer_id' => Auth::id()
|
'enhancer_id' => Auth::id(),
|
||||||
];
|
];
|
||||||
|
|
||||||
$adminIds = User::where('role_id', 1)->pluck('id')->mapWithKeys(function ($id) {
|
$adminIds = User::where('role_id', 1)->pluck('id')->mapWithKeys(function ($id) {
|
||||||
@ -96,13 +101,15 @@ public function accept(Request $request, $id){
|
|||||||
return redirect()->back()->with('failed-status', 'Kerja Sama sudah diterima sebelumnya.');
|
return redirect()->back()->with('failed-status', 'Kerja Sama sudah diterima sebelumnya.');
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("CooperationRequest (accept): ". $e);
|
Log::error('CooperationRequest (accept): '.$e);
|
||||||
|
|
||||||
return redirect()->back()->with('failed-status', 'Proses gagal.');
|
return redirect()->back()->with('failed-status', 'Proses gagal.');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createProposal($id){
|
public function createProposal($id)
|
||||||
|
{
|
||||||
$cooperation = Cooperation::with(['media'])->findOrFail(decrypt_id($id));
|
$cooperation = Cooperation::with(['media'])->findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
$mediaCooperationPivot = $cooperation->media()
|
$mediaCooperationPivot = $cooperation->media()
|
||||||
@ -113,11 +120,12 @@ public function createProposal($id){
|
|||||||
'title' => 'Ajukan Kerja Sama',
|
'title' => 'Ajukan Kerja Sama',
|
||||||
'user' => Auth::user(),
|
'user' => Auth::user(),
|
||||||
'cooperation' => $cooperation,
|
'cooperation' => $cooperation,
|
||||||
'mediaCooperationPivot' => $mediaCooperationPivot
|
'mediaCooperationPivot' => $mediaCooperationPivot,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function storeProposal(JournalistCooperationProposalRequest $request, $id){
|
public function storeProposal(JournalistCooperationProposalRequest $request, $id)
|
||||||
|
{
|
||||||
$validatedData = $request->validated();
|
$validatedData = $request->validated();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -133,7 +141,7 @@ public function storeProposal(JournalistCooperationProposalRequest $request, $id
|
|||||||
$announcementData = [
|
$announcementData = [
|
||||||
'headline' => 'Media <u>'.Auth::user()->company->media->name.'</u> telah mengirimkan formulir pengajuan kerja sama <u>'.$cooperation->name.'</u>',
|
'headline' => 'Media <u>'.Auth::user()->company->media->name.'</u> telah mengirimkan formulir pengajuan kerja sama <u>'.$cooperation->name.'</u>',
|
||||||
'content' => 'Media <u>'.Auth::user()->company->media->name.'</u> telah mengirimkan formulir pengajuan kerja sama <u>'.$cooperation->name.'</u> pada <b>'.idn_date($createdCooperationProposal->created_at, 'l, d F Y H:i').'</b>',
|
'content' => 'Media <u>'.Auth::user()->company->media->name.'</u> telah mengirimkan formulir pengajuan kerja sama <u>'.$cooperation->name.'</u> pada <b>'.idn_date($createdCooperationProposal->created_at, 'l, d F Y H:i').'</b>',
|
||||||
'enhancer_id' => Auth::id()
|
'enhancer_id' => Auth::id(),
|
||||||
];
|
];
|
||||||
|
|
||||||
$adminIds = User::where('role_id', 1)->pluck('id')->mapWithKeys(function ($id) {
|
$adminIds = User::where('role_id', 1)->pluck('id')->mapWithKeys(function ($id) {
|
||||||
@ -149,14 +157,16 @@ public function storeProposal(JournalistCooperationProposalRequest $request, $id
|
|||||||
}
|
}
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::info("ERROR Cooperation Proposals: ". $e);
|
Log::info('ERROR Cooperation Proposals: '.$e);
|
||||||
|
|
||||||
return redirect()->back()->with('failed-status', 'Gagal melakukan pengajuan kerja sama');
|
return redirect()->back()->with('failed-status', 'Gagal melakukan pengajuan kerja sama');
|
||||||
}
|
}
|
||||||
|
|
||||||
return redirect()->route('dashboard.cooperations.requests.index')->with('success-status', 'Berhasil melakukan pengajuan kerja sama.');
|
return redirect()->route('dashboard.cooperations.requests.index')->with('success-status', 'Berhasil melakukan pengajuan kerja sama.');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function reject($id){
|
public function reject($id)
|
||||||
|
{
|
||||||
$cooperation = Cooperation::with(['media'])->findOrFail(decrypt_id($id));
|
$cooperation = Cooperation::with(['media'])->findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
$mediaCooperationPivot = $cooperation->media()
|
$mediaCooperationPivot = $cooperation->media()
|
||||||
@ -166,11 +176,12 @@ public function reject($id){
|
|||||||
return view('dashboard.cooperation-requests.reject', [
|
return view('dashboard.cooperation-requests.reject', [
|
||||||
'title' => 'Tolak Kerja Sama',
|
'title' => 'Tolak Kerja Sama',
|
||||||
'cooperation' => $cooperation,
|
'cooperation' => $cooperation,
|
||||||
'mediaCooperationPivot' => $mediaCooperationPivot
|
'mediaCooperationPivot' => $mediaCooperationPivot,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function rejectAction(Request $request, $id){
|
public function rejectAction(Request $request, $id)
|
||||||
|
{
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (! Auth::check() || Auth::user()->role_id !== 3) {
|
if (! Auth::check() || Auth::user()->role_id !== 3) {
|
||||||
@ -193,7 +204,6 @@ public function rejectAction(Request $request, $id){
|
|||||||
return abort(404, 'Media not found for the cooperation.');
|
return abort(404, 'Media not found for the cooperation.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($mediaCooperation->pivot->status != '3') {
|
if ($mediaCooperation->pivot->status != '3') {
|
||||||
$affectedRows = $cooperation->media()->updateExistingPivot($mediaCooperation->id, [
|
$affectedRows = $cooperation->media()->updateExistingPivot($mediaCooperation->id, [
|
||||||
'status' => '2',
|
'status' => '2',
|
||||||
@ -206,7 +216,7 @@ public function rejectAction(Request $request, $id){
|
|||||||
'content' => '<p>Ajuan Kerja Sama <u>'.$cooperation->name.'</u> <span class="text-danger">ditolak</span> oleh media <u>'.$mediaCooperation->name.'</u></p>
|
'content' => '<p>Ajuan Kerja Sama <u>'.$cooperation->name.'</u> <span class="text-danger">ditolak</span> oleh media <u>'.$mediaCooperation->name.'</u></p>
|
||||||
<p>Alasan: <br> '.$validatedData['rejection_reason'].'</p>
|
<p>Alasan: <br> '.$validatedData['rejection_reason'].'</p>
|
||||||
',
|
',
|
||||||
'enhancer_id' => Auth::id()
|
'enhancer_id' => Auth::id(),
|
||||||
];
|
];
|
||||||
|
|
||||||
$adminIds = User::where('role_id', 1)->pluck('id')->mapWithKeys(function ($id) {
|
$adminIds = User::where('role_id', 1)->pluck('id')->mapWithKeys(function ($id) {
|
||||||
@ -226,23 +236,26 @@ public function rejectAction(Request $request, $id){
|
|||||||
return redirect()->back()->with('failed-status', 'Kerja sama sudah ditolak sebelumnya.');
|
return redirect()->back()->with('failed-status', 'Kerja sama sudah ditolak sebelumnya.');
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("CooperationRequest (rejectAction): ". $e);
|
Log::error('CooperationRequest (rejectAction): '.$e);
|
||||||
|
|
||||||
return redirect()->back()->with('failed-status', 'Proses gagal.');
|
return redirect()->back()->with('failed-status', 'Proses gagal.');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function editProposal($id){
|
public function editProposal($id)
|
||||||
|
{
|
||||||
$proposal = CooperationProposal::with(['cooperation', 'media', 'journalists'])->findOrFail(decrypt_id($id));
|
$proposal = CooperationProposal::with(['cooperation', 'media', 'journalists'])->findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
return view('dashboard.cooperation-requests.media-proposals.edit', [
|
return view('dashboard.cooperation-requests.media-proposals.edit', [
|
||||||
'title' => 'Ubah Ajuan Kerja Sama',
|
'title' => 'Ubah Ajuan Kerja Sama',
|
||||||
'proposal' => $proposal,
|
'proposal' => $proposal,
|
||||||
'selectedJournalists' => $proposal->journalists->pluck('id')->toArray()
|
'selectedJournalists' => $proposal->journalists->pluck('id')->toArray(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updateProposal(JournalistCooperationProposalRequest $request, $id){
|
public function updateProposal(JournalistCooperationProposalRequest $request, $id)
|
||||||
|
{
|
||||||
$validatedData = $request->validated();
|
$validatedData = $request->validated();
|
||||||
$validatedData['media_id'] = Auth::user()->company->media->id;
|
$validatedData['media_id'] = Auth::user()->company->media->id;
|
||||||
|
|
||||||
@ -269,22 +282,24 @@ public function updateProposal(JournalistCooperationProposalRequest $request, $i
|
|||||||
return redirect()->back()->with('failed-status', 'Gagal mengubah pengajuan kerja sama');
|
return redirect()->back()->with('failed-status', 'Gagal mengubah pengajuan kerja sama');
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("CooperationRequest (updateProposal): ". $e);
|
Log::error('CooperationRequest (updateProposal): '.$e);
|
||||||
|
|
||||||
return redirect()->back()->with('failed-status', 'Gagal mengubah pengajuan kerja sama');
|
return redirect()->back()->with('failed-status', 'Gagal mengubah pengajuan kerja sama');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function destroyProposal($id){
|
public function destroyProposal($id)
|
||||||
|
{
|
||||||
try {
|
try {
|
||||||
$cooperationProposal = CooperationProposal::findOrFail(decrypt_id($id));
|
$cooperationProposal = CooperationProposal::findOrFail(decrypt_id($id));
|
||||||
delete_file('app/public/uploads/cooperation-proposals/'.$cooperationProposal->attachment);
|
delete_file('app/public/uploads/cooperation-proposals/'.$cooperationProposal->attachment);
|
||||||
$cooperationProposal->delete();
|
$cooperationProposal->delete();
|
||||||
|
|
||||||
|
|
||||||
return response()->json(['message' => 'Berhasil menghapus ajuan kerja sama.']);
|
return response()->json(['message' => 'Berhasil menghapus ajuan kerja sama.']);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("CooperationRequest (destroyProposal): ". $e);
|
Log::error('CooperationRequest (destroyProposal): '.$e);
|
||||||
|
|
||||||
return response()->json(['message' => 'Gagal menghapus ajuan kerja sama.'], 500);
|
return response()->json(['message' => 'Gagal menghapus ajuan kerja sama.'], 500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,27 +5,27 @@
|
|||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Http\Requests\GovernmentAgencyRequest;
|
use App\Http\Requests\GovernmentAgencyRequest;
|
||||||
use App\Models\GovernmentAgency;
|
use App\Models\GovernmentAgency;
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Support\Facades\Auth;
|
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use Illuminate\Support\Str;
|
|
||||||
|
|
||||||
class GovernmentAgencyController extends Controller
|
class GovernmentAgencyController extends Controller
|
||||||
{
|
{
|
||||||
public function index(){
|
public function index()
|
||||||
|
{
|
||||||
return view('dashboard.government-agencies.index', [
|
return view('dashboard.government-agencies.index', [
|
||||||
'title' => 'Data OPD',
|
'title' => 'Data OPD',
|
||||||
'new_data' => session()->get('new_data', null),
|
'new_data' => session()->get('new_data', null),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function create(){
|
public function create()
|
||||||
|
{
|
||||||
return view('dashboard.government-agencies.create', [
|
return view('dashboard.government-agencies.create', [
|
||||||
'title' => 'Buat OPD Baru'
|
'title' => 'Buat OPD Baru',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function store(GovernmentAgencyRequest $request){
|
public function store(GovernmentAgencyRequest $request)
|
||||||
|
{
|
||||||
$validatedData = $request->validated();
|
$validatedData = $request->validated();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -34,28 +34,32 @@ public function store(GovernmentAgencyRequest $request){
|
|||||||
return redirect()->route('dashboard.government.agencies.index')->with('success-status', 'Berhasil membuat OPD baru.')
|
return redirect()->route('dashboard.government.agencies.index')->with('success-status', 'Berhasil membuat OPD baru.')
|
||||||
->with('new_data', encrypt_id($createdGovernmentAgency->id));
|
->with('new_data', encrypt_id($createdGovernmentAgency->id));
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("GovernmentAgencies (store): ". $e);
|
Log::error('GovernmentAgencies (store): '.$e);
|
||||||
|
|
||||||
return redirect()->back()->with('failed-status', 'Gagal menambahkan OPD');
|
return redirect()->back()->with('failed-status', 'Gagal menambahkan OPD');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function edit($id){
|
public function edit($id)
|
||||||
|
{
|
||||||
$governmentAgency = GovernmentAgency::findOrFail(decrypt_id($id));
|
$governmentAgency = GovernmentAgency::findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
return view('dashboard.government-agencies.edit', [
|
return view('dashboard.government-agencies.edit', [
|
||||||
'title' => 'Ubah OPD',
|
'title' => 'Ubah OPD',
|
||||||
'governmentAgency' => $governmentAgency
|
'governmentAgency' => $governmentAgency,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update(GovernmentAgencyRequest $request, $id){
|
public function update(GovernmentAgencyRequest $request, $id)
|
||||||
|
{
|
||||||
$validatedData = $request->validated();
|
$validatedData = $request->validated();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$governmentAgency = GovernmentAgency::findOrFail(decrypt_id($id));
|
$governmentAgency = GovernmentAgency::findOrFail(decrypt_id($id));
|
||||||
$governmentAgency->update($validatedData);
|
$governmentAgency->update($validatedData);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("GovernmentAgencies (update): ". $e);
|
Log::error('GovernmentAgencies (update): '.$e);
|
||||||
|
|
||||||
return redirect()->back()->with('failed-status', 'Gagal mengubah OPD');
|
return redirect()->back()->with('failed-status', 'Gagal mengubah OPD');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,16 +67,18 @@ public function update(GovernmentAgencyRequest $request, $id){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function show($id){
|
public function show($id)
|
||||||
|
{
|
||||||
$governmentAgency = GovernmentAgency::find(decrypt_id($id));
|
$governmentAgency = GovernmentAgency::find(decrypt_id($id));
|
||||||
|
|
||||||
return view('dashboard.government-agencies.show', [
|
return view('dashboard.government-agencies.show', [
|
||||||
'title' => 'Detail OPD',
|
'title' => 'Detail OPD',
|
||||||
'governmentAgency' => $governmentAgency
|
'governmentAgency' => $governmentAgency,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function destroy($id){
|
public function destroy($id)
|
||||||
|
{
|
||||||
try {
|
try {
|
||||||
$governmentAgency = GovernmentAgency::findOrFail(decrypt_id($id));
|
$governmentAgency = GovernmentAgency::findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
@ -80,7 +86,8 @@ public function destroy($id){
|
|||||||
|
|
||||||
return response()->json(['message' => 'Berhasil menghapus OPD']);
|
return response()->json(['message' => 'Berhasil menghapus OPD']);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("GovernmentAgencies (destroy): ". $e);
|
Log::error('GovernmentAgencies (destroy): '.$e);
|
||||||
|
|
||||||
return response()->json(['message' => 'Gagal menghapus OPD.'], 500);
|
return response()->json(['message' => 'Gagal menghapus OPD.'], 500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,7 +16,8 @@
|
|||||||
|
|
||||||
class JournalistController extends Controller
|
class JournalistController extends Controller
|
||||||
{
|
{
|
||||||
public function index(Request $request){
|
public function index(Request $request)
|
||||||
|
{
|
||||||
if (is_role(['1', '5'])) {
|
if (is_role(['1', '5'])) {
|
||||||
|
|
||||||
if ($request->has('media_ids') && $request->input('media_ids') && count($request->input('media_ids')) > 10) {
|
if ($request->has('media_ids') && $request->input('media_ids') && count($request->input('media_ids')) > 10) {
|
||||||
@ -35,6 +36,7 @@ public function index(Request $request){
|
|||||||
]);
|
]);
|
||||||
} elseif (is_role(['3'])) {
|
} elseif (is_role(['3'])) {
|
||||||
$user = User::with(['role', 'company.media.journalists'])->findOrFail(Auth::id());
|
$user = User::with(['role', 'company.media.journalists'])->findOrFail(Auth::id());
|
||||||
|
|
||||||
return view('dashboard.journalists.index', [
|
return view('dashboard.journalists.index', [
|
||||||
'title' => 'Data Jurnalis',
|
'title' => 'Data Jurnalis',
|
||||||
'user' => $user,
|
'user' => $user,
|
||||||
@ -45,21 +47,25 @@ public function index(Request $request){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function submission(){
|
public function submission()
|
||||||
|
{
|
||||||
return view('dashboard.journalists.submission', [
|
return view('dashboard.journalists.submission', [
|
||||||
'title' => 'Data Permohonan Penambahan Jurnalis'
|
'title' => 'Data Permohonan Penambahan Jurnalis',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function processSubmission($id){
|
public function processSubmission($id)
|
||||||
|
{
|
||||||
$journalist = Journalist::with(['media.company'])->findOrFail(decrypt_id($id));
|
$journalist = Journalist::with(['media.company'])->findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
return view('dashboard.journalists.process-submission', [
|
return view('dashboard.journalists.process-submission', [
|
||||||
'title' => 'Data Permohonan Penambahan Jurnalis',
|
'title' => 'Data Permohonan Penambahan Jurnalis',
|
||||||
'journalist' => $journalist,
|
'journalist' => $journalist,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function processSubmissionAction(Request $request, $id, $action){
|
public function processSubmissionAction(Request $request, $id, $action)
|
||||||
|
{
|
||||||
$journalist = Journalist::with(['media.company'])->findOrFail(decrypt_id($id));
|
$journalist = Journalist::with(['media.company'])->findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
if ($action === 'accept') {
|
if ($action === 'accept') {
|
||||||
@ -81,21 +87,22 @@ public function processSubmissionAction(Request $request, $id, $action){
|
|||||||
|
|
||||||
$rejectedJournalist = $journalist->update([
|
$rejectedJournalist = $journalist->update([
|
||||||
'approved_status' => '2',
|
'approved_status' => '2',
|
||||||
'rejection_reason' => $validatedData['rejection_reason']
|
'rejection_reason' => $validatedData['rejection_reason'],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
return redirect()->route('dashboard.journalists.submissions')->with('success-status', 'Berhasil menolak jurnalis.');
|
return redirect()->route('dashboard.journalists.submissions')->with('success-status', 'Berhasil menolak jurnalis.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function create(){
|
public function create()
|
||||||
|
{
|
||||||
return view('dashboard.journalists.create', [
|
return view('dashboard.journalists.create', [
|
||||||
'title' => 'Tambah Data Jurnalis'
|
'title' => 'Tambah Data Jurnalis',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function store(JournalistRequest $request){
|
public function store(JournalistRequest $request)
|
||||||
|
{
|
||||||
$validatedData = $request->validated();
|
$validatedData = $request->validated();
|
||||||
|
|
||||||
$fileFieldMap = [
|
$fileFieldMap = [
|
||||||
@ -125,7 +132,7 @@ public function store(JournalistRequest $request){
|
|||||||
'approved_at' => null,
|
'approved_at' => null,
|
||||||
'edit_description' => null,
|
'edit_description' => null,
|
||||||
'edit_status' => '0',
|
'edit_status' => '0',
|
||||||
'media_id' => Auth::user()->company->media->id
|
'media_id' => Auth::user()->company->media->id,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($createdJournalist) {
|
if ($createdJournalist) {
|
||||||
@ -135,7 +142,8 @@ public function store(JournalistRequest $request){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function editRequest($id){
|
public function editRequest($id)
|
||||||
|
{
|
||||||
$journalist = Journalist::findOrFail(decrypt_id($id));
|
$journalist = Journalist::findOrFail(decrypt_id($id));
|
||||||
if (! in_array($journalist->edit_status, ['0', '3'])) {
|
if (! in_array($journalist->edit_status, ['0', '3'])) {
|
||||||
abort(404);
|
abort(404);
|
||||||
@ -143,11 +151,12 @@ public function editRequest($id){
|
|||||||
|
|
||||||
return view('dashboard.journalists.edit-request', [
|
return view('dashboard.journalists.edit-request', [
|
||||||
'title' => 'Permohonan Ubah Data Jurnalis',
|
'title' => 'Permohonan Ubah Data Jurnalis',
|
||||||
'journalist' => $journalist
|
'journalist' => $journalist,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function editRequestAction(Request $request, $id){
|
public function editRequestAction(Request $request, $id)
|
||||||
|
{
|
||||||
$journalist = Journalist::findOrFail(decrypt_id($id));
|
$journalist = Journalist::findOrFail(decrypt_id($id));
|
||||||
if (! in_array($journalist->edit_status, ['0', '3'])) {
|
if (! in_array($journalist->edit_status, ['0', '3'])) {
|
||||||
abort(404);
|
abort(404);
|
||||||
@ -165,7 +174,7 @@ public function editRequestAction(Request $request, $id){
|
|||||||
|
|
||||||
$updatedJournalist = $journalist->update([
|
$updatedJournalist = $journalist->update([
|
||||||
'edit_status' => '1',
|
'edit_status' => '1',
|
||||||
'edit_description' => $validatedData['edit_description']
|
'edit_description' => $validatedData['edit_description'],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($updatedJournalist) {
|
if ($updatedJournalist) {
|
||||||
@ -175,7 +184,8 @@ public function editRequestAction(Request $request, $id){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function processEdit($id){
|
public function processEdit($id)
|
||||||
|
{
|
||||||
$journalist = Journalist::findOrFail(decrypt_id($id));
|
$journalist = Journalist::findOrFail(decrypt_id($id));
|
||||||
if (! in_array($journalist->edit_status, ['1', '2']) || ! is_role(['1'])) {
|
if (! in_array($journalist->edit_status, ['1', '2']) || ! is_role(['1'])) {
|
||||||
abort(404);
|
abort(404);
|
||||||
@ -184,11 +194,12 @@ public function processEdit($id){
|
|||||||
return view('dashboard.journalists.show', [
|
return view('dashboard.journalists.show', [
|
||||||
'title' => 'Permohonan Ubah Data Jurnalis',
|
'title' => 'Permohonan Ubah Data Jurnalis',
|
||||||
'journalist' => $journalist,
|
'journalist' => $journalist,
|
||||||
'purpose' => 'processEdit'
|
'purpose' => 'processEdit',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function processEditAction(Request $request, $id, $action){
|
public function processEditAction(Request $request, $id, $action)
|
||||||
|
{
|
||||||
$journalist = Journalist::findOrFail(decrypt_id($id));
|
$journalist = Journalist::findOrFail(decrypt_id($id));
|
||||||
if (! in_array($journalist->edit_status, ['1']) || ! is_role(['1'])) {
|
if (! in_array($journalist->edit_status, ['1']) || ! is_role(['1'])) {
|
||||||
abort(404);
|
abort(404);
|
||||||
@ -214,7 +225,7 @@ public function processEditAction(Request $request, $id, $action){
|
|||||||
|
|
||||||
$journalist->update([
|
$journalist->update([
|
||||||
'edit_status' => '3',
|
'edit_status' => '3',
|
||||||
'edit_rejection_reason' => $validatedData['edit_rejection_reason']
|
'edit_rejection_reason' => $validatedData['edit_rejection_reason'],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return redirect()->route('dashboard.journalists.index')->with('success-status', 'Berhasil menolak permohonan edit jurnalis.');
|
return redirect()->route('dashboard.journalists.index')->with('success-status', 'Berhasil menolak permohonan edit jurnalis.');
|
||||||
@ -222,16 +233,18 @@ public function processEditAction(Request $request, $id, $action){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function edit($id){
|
public function edit($id)
|
||||||
|
{
|
||||||
$journalist = Journalist::findOrFail(decrypt_id($id));
|
$journalist = Journalist::findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
return view('dashboard.journalists.edit', [
|
return view('dashboard.journalists.edit', [
|
||||||
'title' => 'Ubah Data Jurnalis',
|
'title' => 'Ubah Data Jurnalis',
|
||||||
'journalist' => $journalist
|
'journalist' => $journalist,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update(JournalistRequest $request, $id){
|
public function update(JournalistRequest $request, $id)
|
||||||
|
{
|
||||||
$validatedData = $request->validated();
|
$validatedData = $request->validated();
|
||||||
|
|
||||||
$journalist = Journalist::findOrFail(decrypt_id($id));
|
$journalist = Journalist::findOrFail(decrypt_id($id));
|
||||||
@ -266,7 +279,7 @@ public function update(JournalistRequest $request, $id){
|
|||||||
'approved_at' => $journalist->approved_at,
|
'approved_at' => $journalist->approved_at,
|
||||||
'edit_description' => null,
|
'edit_description' => null,
|
||||||
'edit_status' => '0',
|
'edit_status' => '0',
|
||||||
'media_id' => Auth::user()->company->media->id
|
'media_id' => Auth::user()->company->media->id,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($createdJournalist) {
|
if ($createdJournalist) {
|
||||||
@ -276,16 +289,18 @@ public function update(JournalistRequest $request, $id){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function show($id){
|
public function show($id)
|
||||||
|
{
|
||||||
$journalist = Journalist::findOrFail(decrypt_id($id));
|
$journalist = Journalist::findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
return view('dashboard.journalists.show', [
|
return view('dashboard.journalists.show', [
|
||||||
'title' => 'Detail Jurnalis',
|
'title' => 'Detail Jurnalis',
|
||||||
'journalist' => $journalist
|
'journalist' => $journalist,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function destroy($id){
|
public function destroy($id)
|
||||||
|
{
|
||||||
try {
|
try {
|
||||||
$journalist = Journalist::findOrFail(decrypt_id($id));
|
$journalist = Journalist::findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
@ -296,7 +311,7 @@ public function destroy($id){
|
|||||||
if ($journalists->count() <= 1) {
|
if ($journalists->count() <= 1) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status' => 'failed',
|
'status' => 'failed',
|
||||||
'message' => 'Media harus punya minimal satu jurnalis.'
|
'message' => 'Media harus punya minimal satu jurnalis.',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -340,14 +355,13 @@ public function filter(Request $request)
|
|||||||
return redirect()->route('dashboard.journalists.index', $filterField);
|
return redirect()->route('dashboard.journalists.index', $filterField);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function printData($id){
|
public function printData($id)
|
||||||
|
{
|
||||||
|
|
||||||
$journalist = Journalist::with(['media.company'])->findOrFail(decrypt_id($id));
|
$journalist = Journalist::with(['media.company'])->findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
|
|
||||||
$pdf = Pdf::loadView('dashboard.journalists.print', compact('journalist'));
|
$pdf = Pdf::loadView('dashboard.journalists.print', compact('journalist'));
|
||||||
|
|
||||||
return $pdf->stream('perusahaan-'.slugify($journalist->name).'.pdf');
|
return $pdf->stream('perusahaan-'.slugify($journalist->name).'.pdf');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,26 +5,26 @@
|
|||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Http\Requests\LocationRequest;
|
use App\Http\Requests\LocationRequest;
|
||||||
use App\Models\Location;
|
use App\Models\Location;
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Support\Facades\Auth;
|
|
||||||
use Illuminate\Support\Str;
|
|
||||||
|
|
||||||
class LocationController extends Controller
|
class LocationController extends Controller
|
||||||
{
|
{
|
||||||
public function index(){
|
public function index()
|
||||||
|
{
|
||||||
return view('dashboard.locations.index', [
|
return view('dashboard.locations.index', [
|
||||||
'title' => 'Data Lokus',
|
'title' => 'Data Lokus',
|
||||||
'new_data' => session()->get('new_data', null),
|
'new_data' => session()->get('new_data', null),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function create(){
|
public function create()
|
||||||
|
{
|
||||||
return view('dashboard.locations.create', [
|
return view('dashboard.locations.create', [
|
||||||
'title' => 'Buat Lokus Baru'
|
'title' => 'Buat Lokus Baru',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function store(LocationRequest $request){
|
public function store(LocationRequest $request)
|
||||||
|
{
|
||||||
$validatedData = $request->validated();
|
$validatedData = $request->validated();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -37,16 +37,18 @@ public function store(LocationRequest $request){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function edit($id){
|
public function edit($id)
|
||||||
|
{
|
||||||
$location = Location::findOrFail(decrypt_id($id));
|
$location = Location::findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
return view('dashboard.locations.edit', [
|
return view('dashboard.locations.edit', [
|
||||||
'title' => 'Ubah Lokus',
|
'title' => 'Ubah Lokus',
|
||||||
'location' => $location
|
'location' => $location,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update(LocationRequest $request, $id){
|
public function update(LocationRequest $request, $id)
|
||||||
|
{
|
||||||
$validatedData = $request->validated();
|
$validatedData = $request->validated();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -59,16 +61,18 @@ public function update(LocationRequest $request, $id){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function show($id){
|
public function show($id)
|
||||||
|
{
|
||||||
$location = Location::findOrFail(decrypt_id($id));
|
$location = Location::findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
return view('dashboard.locations.show', [
|
return view('dashboard.locations.show', [
|
||||||
'title' => 'Detail Lokus',
|
'title' => 'Detail Lokus',
|
||||||
'location' => $location
|
'location' => $location,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function destroy($id){
|
public function destroy($id)
|
||||||
|
{
|
||||||
try {
|
try {
|
||||||
$location = Location::findOrFail(decrypt_id($id));
|
$location = Location::findOrFail(decrypt_id($id));
|
||||||
$location->delete();
|
$location->delete();
|
||||||
|
|||||||
@ -8,7 +8,8 @@
|
|||||||
|
|
||||||
class LogActivityController extends Controller
|
class LogActivityController extends Controller
|
||||||
{
|
{
|
||||||
public function index(Request $request){
|
public function index(Request $request)
|
||||||
|
{
|
||||||
return view('dashboard.log-activities.index', [
|
return view('dashboard.log-activities.index', [
|
||||||
'title' => 'Log',
|
'title' => 'Log',
|
||||||
'year' => $request->input('year', null),
|
'year' => $request->input('year', null),
|
||||||
@ -19,13 +20,14 @@ public function index(Request $request){
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function show($id){
|
public function show($id)
|
||||||
|
{
|
||||||
$log = Activity::findOrFail(decrypt_id($id));
|
$log = Activity::findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
// dd($log);
|
// dd($log);
|
||||||
return view('dashboard.log-activities.show', [
|
return view('dashboard.log-activities.show', [
|
||||||
'title' => 'Log',
|
'title' => 'Log',
|
||||||
'log' => $log
|
'log' => $log,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,7 +7,8 @@
|
|||||||
|
|
||||||
class LoginHistoryController extends Controller
|
class LoginHistoryController extends Controller
|
||||||
{
|
{
|
||||||
public function index(Request $request){
|
public function index(Request $request)
|
||||||
|
{
|
||||||
return view('dashboard.login-history.index', [
|
return view('dashboard.login-history.index', [
|
||||||
'title' => 'Aktivitas Login',
|
'title' => 'Aktivitas Login',
|
||||||
'year' => $request->input('year', null),
|
'year' => $request->input('year', null),
|
||||||
@ -17,7 +18,8 @@ public function index(Request $request){
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function filter(Request $request){
|
public function filter(Request $request)
|
||||||
|
{
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$filteredRequest = $request->except('_token');
|
$filteredRequest = $request->except('_token');
|
||||||
|
|||||||
@ -17,7 +17,8 @@
|
|||||||
|
|
||||||
class MediaController extends Controller
|
class MediaController extends Controller
|
||||||
{
|
{
|
||||||
public function index(Request $request){
|
public function index(Request $request)
|
||||||
|
{
|
||||||
if (is_role(['1', '5'])) {
|
if (is_role(['1', '5'])) {
|
||||||
return view('dashboard.media.admin.index', [
|
return view('dashboard.media.admin.index', [
|
||||||
'title' => 'Data Media',
|
'title' => 'Data Media',
|
||||||
@ -42,17 +43,19 @@ public function index(Request $request){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function editRequest(){
|
public function editRequest()
|
||||||
|
{
|
||||||
if (! in_array(Auth::user()->company->media->edit_status, ['0', '3'])) {
|
if (! in_array(Auth::user()->company->media->edit_status, ['0', '3'])) {
|
||||||
abort(404);
|
abort(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
return view('dashboard.media.edit-request', [
|
return view('dashboard.media.edit-request', [
|
||||||
'title' => 'Permohonan Ubah Data Media'
|
'title' => 'Permohonan Ubah Data Media',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function editRequestAction(Request $request){
|
public function editRequestAction(Request $request)
|
||||||
|
{
|
||||||
try {
|
try {
|
||||||
if (! in_array(Auth::user()->company->media->edit_status, ['0', '3'])) {
|
if (! in_array(Auth::user()->company->media->edit_status, ['0', '3'])) {
|
||||||
abort(404);
|
abort(404);
|
||||||
@ -71,7 +74,7 @@ public function editRequestAction(Request $request){
|
|||||||
$user = User::with(['company.media'])->findOrFail(Auth::id());
|
$user = User::with(['company.media'])->findOrFail(Auth::id());
|
||||||
$user->company->media->update([
|
$user->company->media->update([
|
||||||
'edit_status' => '1',
|
'edit_status' => '1',
|
||||||
'edit_description' => $validatedData['edit_description']
|
'edit_description' => $validatedData['edit_description'],
|
||||||
]);
|
]);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return redirect()->route('dashboard.media.index')->with('failed-status', 'Gagal melakukan permohonan edit data media.');
|
return redirect()->route('dashboard.media.index')->with('failed-status', 'Gagal melakukan permohonan edit data media.');
|
||||||
@ -81,7 +84,8 @@ public function editRequestAction(Request $request){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function edit(){
|
public function edit()
|
||||||
|
{
|
||||||
if (! in_array(Auth::user()->company->media->edit_status, ['2'])) {
|
if (! in_array(Auth::user()->company->media->edit_status, ['2'])) {
|
||||||
abort(404);
|
abort(404);
|
||||||
}
|
}
|
||||||
@ -90,11 +94,12 @@ public function edit(){
|
|||||||
|
|
||||||
return view('dashboard.media.edit', [
|
return view('dashboard.media.edit', [
|
||||||
'title' => 'Ubah Data Media',
|
'title' => 'Ubah Data Media',
|
||||||
'user' => $user
|
'user' => $user,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update(MediaRequest $request){
|
public function update(MediaRequest $request)
|
||||||
|
{
|
||||||
$validatedData = $request->validated();
|
$validatedData = $request->validated();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -102,7 +107,6 @@ public function update(MediaRequest $request){
|
|||||||
abort(404);
|
abort(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$media = User::with(['company.media'])->findOrFail(Auth::id())->company->media;
|
$media = User::with(['company.media'])->findOrFail(Auth::id())->company->media;
|
||||||
|
|
||||||
$fileFieldMap = [
|
$fileFieldMap = [
|
||||||
@ -140,7 +144,8 @@ public function update(MediaRequest $request){
|
|||||||
return redirect()->route('dashboard.media.index')->with('success-status', 'Berhasil mengubah data media.');
|
return redirect()->route('dashboard.media.index')->with('success-status', 'Berhasil mengubah data media.');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function show($id, $type){
|
public function show($id, $type)
|
||||||
|
{
|
||||||
$user = User::with(['role', 'company.media.journalists'])->findOrFail(decrypt_id($id));
|
$user = User::with(['role', 'company.media.journalists'])->findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
@ -151,7 +156,7 @@ public function show($id, $type){
|
|||||||
'purpose' => 'show',
|
'purpose' => 'show',
|
||||||
'idnPage' => 'media',
|
'idnPage' => 'media',
|
||||||
'route' => 'media',
|
'route' => 'media',
|
||||||
'type' => $type
|
'type' => $type,
|
||||||
];
|
];
|
||||||
|
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
@ -162,6 +167,7 @@ public function show($id, $type){
|
|||||||
$data['loginActivities'] = LoginHistory::where('user_id', $user->id)
|
$data['loginActivities'] = LoginHistory::where('user_id', $user->id)
|
||||||
->orderByDesc('id')
|
->orderByDesc('id')
|
||||||
->simplePaginate(20);
|
->simplePaginate(20);
|
||||||
|
|
||||||
return view('dashboard.users.profiles.login-activity', $data);
|
return view('dashboard.users.profiles.login-activity', $data);
|
||||||
|
|
||||||
case 'company':
|
case 'company':
|
||||||
@ -179,14 +185,16 @@ public function show($id, $type){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function destroy($id){
|
public function destroy($id)
|
||||||
|
{
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status' => 'warning',
|
'status' => 'warning',
|
||||||
'message' => 'Aksi belum tersedia.'
|
'message' => 'Aksi belum tersedia.',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function process(Request $request, $id, $type){
|
public function process(Request $request, $id, $type)
|
||||||
|
{
|
||||||
$user = User::with(['role', 'company.media.journalists'])->findOrFail(decrypt_id($id));
|
$user = User::with(['role', 'company.media.journalists'])->findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
if ($request->query('category') && ! in_array($request->query('category'), ['account-status', 'edit-request'])) {
|
if ($request->query('category') && ! in_array($request->query('category'), ['account-status', 'edit-request'])) {
|
||||||
@ -202,7 +210,7 @@ public function process(Request $request, $id, $type){
|
|||||||
'idnPage' => 'media',
|
'idnPage' => 'media',
|
||||||
'route' => 'media',
|
'route' => 'media',
|
||||||
'type' => $type,
|
'type' => $type,
|
||||||
'category' => $request->query('category', null)
|
'category' => $request->query('category', null),
|
||||||
];
|
];
|
||||||
|
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
@ -213,6 +221,7 @@ public function process(Request $request, $id, $type){
|
|||||||
$data['loginActivities'] = LoginHistory::where('user_id', $user->id)
|
$data['loginActivities'] = LoginHistory::where('user_id', $user->id)
|
||||||
->orderByDesc('id')
|
->orderByDesc('id')
|
||||||
->simplePaginate(20);
|
->simplePaginate(20);
|
||||||
|
|
||||||
return view('dashboard.users.profiles.login-activity', $data);
|
return view('dashboard.users.profiles.login-activity', $data);
|
||||||
|
|
||||||
case 'company':
|
case 'company':
|
||||||
@ -229,7 +238,8 @@ public function process(Request $request, $id, $type){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function processAcceptAction(Request $request, $id, $type, $category){
|
public function processAcceptAction(Request $request, $id, $type, $category)
|
||||||
|
{
|
||||||
$user = User::with(['company'])->findOrFail(decrypt_id($id));
|
$user = User::with(['company'])->findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
if (! in_array($category, ['account-status', 'edit-request']) || ! is_role(['1'])) {
|
if (! in_array($category, ['account-status', 'edit-request']) || ! is_role(['1'])) {
|
||||||
@ -238,16 +248,17 @@ public function processAcceptAction(Request $request, $id, $type, $category){
|
|||||||
|
|
||||||
if (is_role(['1']) && $category === 'edit-request') {
|
if (is_role(['1']) && $category === 'edit-request') {
|
||||||
$user->company->media->update([
|
$user->company->media->update([
|
||||||
'edit_status' => '2'
|
'edit_status' => '2',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'message' => 'Berhasil menyetujui permohonan edit media.'
|
'message' => 'Berhasil menyetujui permohonan edit media.',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function processRejectAction(Request $request, $id, $type, $category){
|
public function processRejectAction(Request $request, $id, $type, $category)
|
||||||
|
{
|
||||||
$user = User::with(['company'])->findOrFail(decrypt_id($id));
|
$user = User::with(['company'])->findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
if (! in_array($category, ['account-status', 'edit-request']) || ! is_role(['1'])) {
|
if (! in_array($category, ['account-status', 'edit-request']) || ! is_role(['1'])) {
|
||||||
@ -265,7 +276,7 @@ public function processRejectAction(Request $request, $id, $type, $category){
|
|||||||
if ($category === 'edit-request' && $user->company->media->edit_status === '1') {
|
if ($category === 'edit-request' && $user->company->media->edit_status === '1') {
|
||||||
$user->company->media->update([
|
$user->company->media->update([
|
||||||
'edit_status' => '3',
|
'edit_status' => '3',
|
||||||
'edit_rejection_reason' => $validatedData['rejection_reason']
|
'edit_rejection_reason' => $validatedData['rejection_reason'],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -293,7 +304,8 @@ public function export(Request $request)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function filter(Request $request){
|
public function filter(Request $request)
|
||||||
|
{
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$filteredRequest = $request->except('_token');
|
$filteredRequest = $request->except('_token');
|
||||||
@ -308,7 +320,8 @@ public function filter(Request $request){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function printData($id){
|
public function printData($id)
|
||||||
|
{
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$media = Media::with(['user.role', 'company'])->findOrFail(decrypt_id($id));
|
$media = Media::with(['user.role', 'company'])->findOrFail(decrypt_id($id));
|
||||||
|
|||||||
@ -19,7 +19,8 @@
|
|||||||
|
|
||||||
class MediaCooperationController extends Controller
|
class MediaCooperationController extends Controller
|
||||||
{
|
{
|
||||||
public function index(Request $request){
|
public function index(Request $request)
|
||||||
|
{
|
||||||
return view('dashboard.media-cooperations.index', [
|
return view('dashboard.media-cooperations.index', [
|
||||||
'title' => 'Kerja Sama',
|
'title' => 'Kerja Sama',
|
||||||
'date' => $request->input('date', null),
|
'date' => $request->input('date', null),
|
||||||
@ -28,14 +29,16 @@ public function index(Request $request){
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function create(){
|
public function create()
|
||||||
|
{
|
||||||
return view('dashboard.media-cooperations.create', [
|
return view('dashboard.media-cooperations.create', [
|
||||||
'title' => 'Tambah Kerja Sama',
|
'title' => 'Tambah Kerja Sama',
|
||||||
'media' => Media::all()
|
'media' => Media::all(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function store(CooperationRequest $request){
|
public function store(CooperationRequest $request)
|
||||||
|
{
|
||||||
$validatedData = $request->validated();
|
$validatedData = $request->validated();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -75,7 +78,7 @@ public function store(CooperationRequest $request){
|
|||||||
'.$createdCooperation->description.'
|
'.$createdCooperation->description.'
|
||||||
</p>
|
</p>
|
||||||
',
|
',
|
||||||
'enhancer_id' => Auth::id()
|
'enhancer_id' => Auth::id(),
|
||||||
];
|
];
|
||||||
$createdAnnouncement = Announcement::create($announcementData);
|
$createdAnnouncement = Announcement::create($announcementData);
|
||||||
$createdAnnouncement->users()->attach($userId, ['category' => 'system']);
|
$createdAnnouncement->users()->attach($userId, ['category' => 'system']);
|
||||||
@ -90,22 +93,26 @@ public function store(CooperationRequest $request){
|
|||||||
return redirect()->back()->with('failed-status', 'Gagal menambahkan kerja sama');
|
return redirect()->back()->with('failed-status', 'Gagal menambahkan kerja sama');
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::info("ERROR (Cooperation): ". $e);
|
Log::info('ERROR (Cooperation): '.$e);
|
||||||
|
|
||||||
return redirect()->back()->with('failed-status', 'Gagal menambahkan kerja sama');
|
return redirect()->back()->with('failed-status', 'Gagal menambahkan kerja sama');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function edit($id){
|
public function edit($id)
|
||||||
|
{
|
||||||
$cooperation = Cooperation::with(['media'])->findOrFail(decrypt_id($id));
|
$cooperation = Cooperation::with(['media'])->findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
return view('dashboard.media-cooperations.edit', [
|
return view('dashboard.media-cooperations.edit', [
|
||||||
'title' => 'Ubah Kerja Sama',
|
'title' => 'Ubah Kerja Sama',
|
||||||
'cooperation' => $cooperation,
|
'cooperation' => $cooperation,
|
||||||
'media' => Media::all(),
|
'media' => Media::all(),
|
||||||
'selectedMediaIds' => $cooperation->media->pluck('id')->toArray()
|
'selectedMediaIds' => $cooperation->media->pluck('id')->toArray(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update(CooperationRequest $request, $id){
|
public function update(CooperationRequest $request, $id)
|
||||||
|
{
|
||||||
$validatedData = $request->validated();
|
$validatedData = $request->validated();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -142,7 +149,7 @@ public function update(CooperationRequest $request, $id){
|
|||||||
'content' => '<p>Admin telah melakukan pembaruan pada kerja sama <u>'.$oldCooperationName.'</u>.
|
'content' => '<p>Admin telah melakukan pembaruan pada kerja sama <u>'.$oldCooperationName.'</u>.
|
||||||
Mohon untuk segera meninjau perubahan tersebut</p>
|
Mohon untuk segera meninjau perubahan tersebut</p>
|
||||||
',
|
',
|
||||||
'enhancer_id' => Auth::id()
|
'enhancer_id' => Auth::id(),
|
||||||
];
|
];
|
||||||
$createdAnnouncement = Announcement::create($announcementData);
|
$createdAnnouncement = Announcement::create($announcementData);
|
||||||
$createdAnnouncement->users()->attach($userId, ['category' => 'system']);
|
$createdAnnouncement->users()->attach($userId, ['category' => 'system']);
|
||||||
@ -159,12 +166,13 @@ public function update(CooperationRequest $request, $id){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function show($id){
|
public function show($id)
|
||||||
|
{
|
||||||
$mediaCooperation = Cooperation::with(['media'])->findOrFail(decrypt_id($id));
|
$mediaCooperation = Cooperation::with(['media'])->findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
return view('dashboard.media-cooperations.show', [
|
return view('dashboard.media-cooperations.show', [
|
||||||
'title' => 'Detail Kerja Sama',
|
'title' => 'Detail Kerja Sama',
|
||||||
'mediaCooperation' => $mediaCooperation
|
'mediaCooperation' => $mediaCooperation,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,6 +185,7 @@ public function export(Request $request)
|
|||||||
$date = $request->input('date', null);
|
$date = $request->input('date', null);
|
||||||
|
|
||||||
$formattedNow = Carbon::parse(now())->locale('id')->translatedFormat('d-m-Y');
|
$formattedNow = Carbon::parse(now())->locale('id')->translatedFormat('d-m-Y');
|
||||||
|
|
||||||
return Excel::download(new CooperationExport($year, $month, $date), 'cooperations-'.$formattedNow.'.xlsx');
|
return Excel::download(new CooperationExport($year, $month, $date), 'cooperations-'.$formattedNow.'.xlsx');
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return redirect()->back()->with('failed-status', 'Gagal melakukan proses export data.');
|
return redirect()->back()->with('failed-status', 'Gagal melakukan proses export data.');
|
||||||
@ -184,7 +193,8 @@ public function export(Request $request)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function filter(Request $request){
|
public function filter(Request $request)
|
||||||
|
{
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$filteredRequest = $request->except('_token');
|
$filteredRequest = $request->except('_token');
|
||||||
@ -198,34 +208,36 @@ public function filter(Request $request){
|
|||||||
return redirect()->back()->with('status-failed', 'Gagal melakukan proses filtering data.');
|
return redirect()->back()->with('status-failed', 'Gagal melakukan proses filtering data.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function mediaProposal($id){
|
public function mediaProposal($id)
|
||||||
|
{
|
||||||
$mediaCooperation = Cooperation::with(['media'])->findOrFail(decrypt_id($id));
|
$mediaCooperation = Cooperation::with(['media'])->findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
return view('dashboard.media-cooperations.media-proposals.index', [
|
return view('dashboard.media-cooperations.media-proposals.index', [
|
||||||
'title' => 'Data Pengajuan Kerja Sama',
|
'title' => 'Data Pengajuan Kerja Sama',
|
||||||
'mediaCooperation' => $mediaCooperation
|
'mediaCooperation' => $mediaCooperation,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function mediaProposalShow($id, $proposalId){
|
public function mediaProposalShow($id, $proposalId)
|
||||||
|
{
|
||||||
$proposal = CooperationProposal::with(['cooperation', 'media', 'journalists'])->findOrFail(decrypt_id($proposalId));
|
$proposal = CooperationProposal::with(['cooperation', 'media', 'journalists'])->findOrFail(decrypt_id($proposalId));
|
||||||
|
|
||||||
return view('dashboard.media-cooperations.media-proposals.show', [
|
return view('dashboard.media-cooperations.media-proposals.show', [
|
||||||
'title' => 'Detail Ajuan Kerja Sama',
|
'title' => 'Detail Ajuan Kerja Sama',
|
||||||
'proposal' => $proposal
|
'proposal' => $proposal,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function mediaProposalAccept($id, $proposalId){
|
public function mediaProposalAccept($id, $proposalId)
|
||||||
|
{
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$proposal = CooperationProposal::with(['cooperation', 'media', 'journalists'])->findOrFail(decrypt_id($proposalId));
|
$proposal = CooperationProposal::with(['cooperation', 'media', 'journalists'])->findOrFail(decrypt_id($proposalId));
|
||||||
|
|
||||||
$acceptedProposal = $proposal->update([
|
$acceptedProposal = $proposal->update([
|
||||||
'status' => '1'
|
'status' => '1',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Announcements
|
// Announcements
|
||||||
@ -233,7 +245,7 @@ public function mediaProposalAccept($id, $proposalId){
|
|||||||
'headline' => 'Formulir ajuan kerja sama <u>'.$proposal->cooperation->name.'</u> telah <span class="text-primary">disetujui</span>',
|
'headline' => 'Formulir ajuan kerja sama <u>'.$proposal->cooperation->name.'</u> telah <span class="text-primary">disetujui</span>',
|
||||||
'content' => '<p>Admin telah menyetujui formulir pengajuan kerja sama Anda.</p>
|
'content' => '<p>Admin telah menyetujui formulir pengajuan kerja sama Anda.</p>
|
||||||
<p>Sekarang, kerja sama ini sudah tersedia di menu <b>Kerja Sama</b>. Harap tunggu hingga Admin menerbitkan <b>Media Order</b>.</p>',
|
<p>Sekarang, kerja sama ini sudah tersedia di menu <b>Kerja Sama</b>. Harap tunggu hingga Admin menerbitkan <b>Media Order</b>.</p>',
|
||||||
'enhancer_id' => Auth::id()
|
'enhancer_id' => Auth::id(),
|
||||||
];
|
];
|
||||||
$createdAnnouncement = Announcement::create($announcementData);
|
$createdAnnouncement = Announcement::create($announcementData);
|
||||||
$createdAnnouncement->users()->attach($proposal->media->company->user->id, ['category' => 'system']);
|
$createdAnnouncement->users()->attach($proposal->media->company->user->id, ['category' => 'system']);
|
||||||
@ -250,16 +262,18 @@ public function mediaProposalAccept($id, $proposalId){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function mediaProposalReject($id, $proposalId){
|
public function mediaProposalReject($id, $proposalId)
|
||||||
|
{
|
||||||
$proposal = CooperationProposal::with(['cooperation', 'media', 'journalists'])->findOrFail(decrypt_id($proposalId));
|
$proposal = CooperationProposal::with(['cooperation', 'media', 'journalists'])->findOrFail(decrypt_id($proposalId));
|
||||||
|
|
||||||
return view('dashboard.media-cooperations.media-proposals.reject', [
|
return view('dashboard.media-cooperations.media-proposals.reject', [
|
||||||
'title' => 'Tolak Ajuan Kerja Sama',
|
'title' => 'Tolak Ajuan Kerja Sama',
|
||||||
'proposal' => $proposal
|
'proposal' => $proposal,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function mediaProposalRejectAction(Request $request, $id, $proposalId){
|
public function mediaProposalRejectAction(Request $request, $id, $proposalId)
|
||||||
|
{
|
||||||
|
|
||||||
$validatedData = $request->validate([
|
$validatedData = $request->validate([
|
||||||
'rejection_reason' => ['required'],
|
'rejection_reason' => ['required'],
|
||||||
@ -272,7 +286,7 @@ public function mediaProposalRejectAction(Request $request, $id, $proposalId){
|
|||||||
|
|
||||||
$rejectedProposal = $proposal->update([
|
$rejectedProposal = $proposal->update([
|
||||||
'status' => '2',
|
'status' => '2',
|
||||||
'rejection_reason' => $validatedData['rejection_reason']
|
'rejection_reason' => $validatedData['rejection_reason'],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Announcements
|
// Announcements
|
||||||
@ -282,7 +296,7 @@ public function mediaProposalRejectAction(Request $request, $id, $proposalId){
|
|||||||
<p>Alasan penolakan:<br> '.$validatedData['rejection_reason'].' </p>
|
<p>Alasan penolakan:<br> '.$validatedData['rejection_reason'].' </p>
|
||||||
</p>
|
</p>
|
||||||
',
|
',
|
||||||
'enhancer_id' => Auth::id()
|
'enhancer_id' => Auth::id(),
|
||||||
];
|
];
|
||||||
$createdAnnouncement = Announcement::create($announcementData);
|
$createdAnnouncement = Announcement::create($announcementData);
|
||||||
$createdAnnouncement->users()->attach($proposal->media->company->user->id, ['category' => 'system']);
|
$createdAnnouncement->users()->attach($proposal->media->company->user->id, ['category' => 'system']);
|
||||||
@ -299,23 +313,24 @@ public function mediaProposalRejectAction(Request $request, $id, $proposalId){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function process($id, $process, $paramMediaId = null){
|
public function process($id, $process, $paramMediaId = null)
|
||||||
|
{
|
||||||
$mediaCooperation = Cooperation::with([
|
$mediaCooperation = Cooperation::with([
|
||||||
'media',
|
'media',
|
||||||
'mediaOrder.media',
|
'mediaOrder.media',
|
||||||
'mediaOrder.reports',
|
'mediaOrder.reports',
|
||||||
'mediaOrder.completions'
|
'mediaOrder.completions',
|
||||||
])->findOrFail(decrypt_id($id));
|
])->findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'process' => $process,
|
'process' => $process,
|
||||||
'mediaCooperation' => $mediaCooperation,
|
'mediaCooperation' => $mediaCooperation,
|
||||||
'mediaOrder' => $mediaCooperation->mediaOrder,
|
'mediaOrder' => $mediaCooperation->mediaOrder,
|
||||||
'mediaId' => is_role(['3']) ? Auth::user()->company->media->id : null
|
'mediaId' => is_role(['3']) ? Auth::user()->company->media->id : null,
|
||||||
];
|
];
|
||||||
|
|
||||||
if (is_role(['3']) && $data['mediaOrder'] && $data['mediaOrder']->reports) {
|
if (is_role(['3']) && $data['mediaOrder'] && $data['mediaOrder']->reports) {
|
||||||
$reports = $data['mediaOrder']->reports->filter(function ($reports) use ($data) {
|
$reports = $data['mediaOrder']->reports->filter(function ($reports) {
|
||||||
return $reports->media_id == Auth::user()->company->media->id;
|
return $reports->media_id == Auth::user()->company->media->id;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -348,7 +363,7 @@ public function process($id, $process, $paramMediaId = null){
|
|||||||
|
|
||||||
// Can Commented
|
// Can Commented
|
||||||
if ($mediaOrderSafe) {
|
if ($mediaOrderSafe) {
|
||||||
$reports = $data['mediaOrder']->reports->filter(function ($reports) use ($data) {
|
$reports = $data['mediaOrder']->reports->filter(function ($reports) {
|
||||||
return $reports->media_id == Auth::user()->company->media->id;
|
return $reports->media_id == Auth::user()->company->media->id;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@ -378,7 +393,7 @@ public function process($id, $process, $paramMediaId = null){
|
|||||||
$data['mediaOrderPivot'] = $data['mediaOrder']->media->where('id', $data['mediaId'])->first()->pivot;
|
$data['mediaOrderPivot'] = $data['mediaOrder']->media->where('id', $data['mediaId'])->first()->pivot;
|
||||||
|
|
||||||
// Can Commented
|
// Can Commented
|
||||||
$reports = $data['mediaOrder']->reports->filter(function ($reports) use ($data) {
|
$reports = $data['mediaOrder']->reports->filter(function ($reports) {
|
||||||
return $reports->media_id == Auth::user()->company->media->id;
|
return $reports->media_id == Auth::user()->company->media->id;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -507,7 +522,6 @@ public function process($id, $process, $paramMediaId = null){
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
// Tab Selesai
|
// Tab Selesai
|
||||||
} elseif ($process === 'completion') {
|
} elseif ($process === 'completion') {
|
||||||
$data['title'] = 'Penyelesaian';
|
$data['title'] = 'Penyelesaian';
|
||||||
@ -541,8 +555,7 @@ public function process($id, $process, $paramMediaId = null){
|
|||||||
abort(404);
|
abort(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} elseif ($process === 'completions') {
|
||||||
else if($process === 'completions'){
|
|
||||||
$data['title'] = 'Penyelesaian';
|
$data['title'] = 'Penyelesaian';
|
||||||
|
|
||||||
$data['isHaveReports'] = true;
|
$data['isHaveReports'] = true;
|
||||||
@ -561,7 +574,8 @@ public function process($id, $process, $paramMediaId = null){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function destroy($id){
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$cooperation = Cooperation::with(['media', 'mediaOrder'])->findOrFail(decrypt_id($id));
|
$cooperation = Cooperation::with(['media', 'mediaOrder'])->findOrFail(decrypt_id($id));
|
||||||
@ -575,14 +589,12 @@ public function destroy($id){
|
|||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status' => 'success',
|
'status' => 'success',
|
||||||
'message' => 'Ajuan kerja sama dan semua media berhasil dihapus.'
|
'message' => 'Ajuan kerja sama dan semua media berhasil dihapus.',
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
return response()->json(['message' => 'Kerja Sama sudah memiliki media order.'], 500);
|
return response()->json(['message' => 'Kerja Sama sudah memiliki media order.'], 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return response()->json(['message' => 'Gagal menghapus ajuan kerja sama.'], 500);
|
return response()->json(['message' => 'Gagal menghapus ajuan kerja sama.'], 500);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,12 +9,12 @@
|
|||||||
use Barryvdh\DomPDF\Facade\Pdf;
|
use Barryvdh\DomPDF\Facade\Pdf;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Auth;
|
|
||||||
use Maatwebsite\Excel\Facades\Excel;
|
use Maatwebsite\Excel\Facades\Excel;
|
||||||
|
|
||||||
class MediaMonitoringController extends Controller
|
class MediaMonitoringController extends Controller
|
||||||
{
|
{
|
||||||
public function index(Request $request){
|
public function index(Request $request)
|
||||||
|
{
|
||||||
return view('dashboard.media-monitorings.index', [
|
return view('dashboard.media-monitorings.index', [
|
||||||
'title' => 'Monitoring Media',
|
'title' => 'Monitoring Media',
|
||||||
'news_title' => $request->input('news_title', null),
|
'news_title' => $request->input('news_title', null),
|
||||||
@ -30,13 +30,15 @@ public function index(Request $request){
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function create(){
|
public function create()
|
||||||
|
{
|
||||||
return view('dashboard.media-monitorings.create', [
|
return view('dashboard.media-monitorings.create', [
|
||||||
'title' => 'Tambah Monitoring Media'
|
'title' => 'Tambah Monitoring Media',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function store(MediaMonitoringRequest $request){
|
public function store(MediaMonitoringRequest $request)
|
||||||
|
{
|
||||||
$validatedData = $request->validated();
|
$validatedData = $request->validated();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -56,17 +58,19 @@ public function store(MediaMonitoringRequest $request){
|
|||||||
return redirect()->back()->with('success-status', 'Berhasil menambahkan monitoring media.');
|
return redirect()->back()->with('success-status', 'Berhasil menambahkan monitoring media.');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function edit($id){
|
public function edit($id)
|
||||||
|
{
|
||||||
|
|
||||||
$mediaMonitoring = MediaMonitoring::findOrFail(decrypt_id($id));
|
$mediaMonitoring = MediaMonitoring::findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
return view('dashboard.media-monitorings.edit', [
|
return view('dashboard.media-monitorings.edit', [
|
||||||
'title' => 'Ubah Monitoring Media',
|
'title' => 'Ubah Monitoring Media',
|
||||||
'mediaMonitoring' => $mediaMonitoring
|
'mediaMonitoring' => $mediaMonitoring,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update(MediaMonitoringRequest $request, $id){
|
public function update(MediaMonitoringRequest $request, $id)
|
||||||
|
{
|
||||||
$validatedData = $request->validated();
|
$validatedData = $request->validated();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -88,23 +92,24 @@ public function update(MediaMonitoringRequest $request, $id){
|
|||||||
return redirect()->route('dashboard.media.monitorings.show', ['id' => encrypt_id($mediaMonitoring->id)])->with('success-status', 'Berhasil mengubah monitoring media.');
|
return redirect()->route('dashboard.media.monitorings.show', ['id' => encrypt_id($mediaMonitoring->id)])->with('success-status', 'Berhasil mengubah monitoring media.');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function show($id){
|
public function show($id)
|
||||||
|
{
|
||||||
|
|
||||||
$mediaMonitoring = MediaMonitoring::findOrFail(decrypt_id($id));
|
$mediaMonitoring = MediaMonitoring::findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
return view('dashboard.media-monitorings.show', [
|
return view('dashboard.media-monitorings.show', [
|
||||||
'title' => 'Detail Monitoring Media',
|
'title' => 'Detail Monitoring Media',
|
||||||
'mediaMonitoring' => $mediaMonitoring
|
'mediaMonitoring' => $mediaMonitoring,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function destroy($id){
|
public function destroy($id)
|
||||||
|
{
|
||||||
try {
|
try {
|
||||||
$mediaMonitoring = MediaMonitoring::findOrFail(decrypt_id($id));
|
$mediaMonitoring = MediaMonitoring::findOrFail(decrypt_id($id));
|
||||||
delete_file('app/public/uploads/media-monitorings/'.$mediaMonitoring->image);
|
delete_file('app/public/uploads/media-monitorings/'.$mediaMonitoring->image);
|
||||||
$mediaMonitoring->delete();
|
$mediaMonitoring->delete();
|
||||||
|
|
||||||
|
|
||||||
return response()->json(['message' => 'Berhasil menghapus monitoring media.']);
|
return response()->json(['message' => 'Berhasil menghapus monitoring media.']);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return response()->json(['message' => 'Gagal menghapus monitoring media.'], 500);
|
return response()->json(['message' => 'Gagal menghapus monitoring media.'], 500);
|
||||||
@ -116,11 +121,12 @@ public function checkLink(Request $request)
|
|||||||
$linkExists = MediaMonitoring::where('link', $request->link)->exists();
|
$linkExists = MediaMonitoring::where('link', $request->link)->exists();
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'exists' => $linkExists
|
'exists' => $linkExists,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function filter(Request $request){
|
public function filter(Request $request)
|
||||||
|
{
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$filteredRequest = $request->except('_token');
|
$filteredRequest = $request->except('_token');
|
||||||
@ -159,7 +165,8 @@ public function export(Request $request)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function printData($id){
|
public function printData($id)
|
||||||
|
{
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$mediaMonitoring = MediaMonitoring::with(['enhancer', 'issue'])->findOrFail(decrypt_id($id));
|
$mediaMonitoring = MediaMonitoring::with(['enhancer', 'issue'])->findOrFail(decrypt_id($id));
|
||||||
|
|||||||
@ -15,7 +15,8 @@
|
|||||||
|
|
||||||
class MediaOrderController extends Controller
|
class MediaOrderController extends Controller
|
||||||
{
|
{
|
||||||
public function create($id){
|
public function create($id)
|
||||||
|
{
|
||||||
$cooperation = Cooperation::findOrFail(decrypt_id($id));
|
$cooperation = Cooperation::findOrFail(decrypt_id($id));
|
||||||
$media = $cooperation->proposals->where('status', '1')->pluck('media_id');
|
$media = $cooperation->proposals->where('status', '1')->pluck('media_id');
|
||||||
|
|
||||||
@ -23,11 +24,12 @@ public function create($id){
|
|||||||
'title' => 'Buat Media Order',
|
'title' => 'Buat Media Order',
|
||||||
'cooperation' => $cooperation,
|
'cooperation' => $cooperation,
|
||||||
'media' => Media::all(),
|
'media' => Media::all(),
|
||||||
'acceptedMedia' => $media
|
'acceptedMedia' => $media,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function store(OrderRequest $request, $id){
|
public function store(OrderRequest $request, $id)
|
||||||
|
{
|
||||||
$validatedData = $request->validated();
|
$validatedData = $request->validated();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -53,7 +55,7 @@ public function store(OrderRequest $request, $id){
|
|||||||
$announcementData = [
|
$announcementData = [
|
||||||
'headline' => '<p>Admin telah menerbitkan media order kerja sama <u>'.$cooperation->name.'</u></p>',
|
'headline' => '<p>Admin telah menerbitkan media order kerja sama <u>'.$cooperation->name.'</u></p>',
|
||||||
'content' => '<p>Admin telah menerbitkan media order kerja sama '.$cooperation->name.'</p>',
|
'content' => '<p>Admin telah menerbitkan media order kerja sama '.$cooperation->name.'</p>',
|
||||||
'enhancer_id' => Auth::id()
|
'enhancer_id' => Auth::id(),
|
||||||
];
|
];
|
||||||
$createdAnnouncement = Announcement::create($announcementData);
|
$createdAnnouncement = Announcement::create($announcementData);
|
||||||
$createdAnnouncement->users()->attach($userId, ['category' => 'system']);
|
$createdAnnouncement->users()->attach($userId, ['category' => 'system']);
|
||||||
@ -72,7 +74,8 @@ public function store(OrderRequest $request, $id){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function edit($id){
|
public function edit($id)
|
||||||
|
{
|
||||||
// $cooperation = Cooperation::findOrFail(decrypt_id($id));
|
// $cooperation = Cooperation::findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
$mediaOrder = Order::findOrFail(decrypt_id($id));
|
$mediaOrder = Order::findOrFail(decrypt_id($id));
|
||||||
@ -86,11 +89,12 @@ public function edit($id){
|
|||||||
'mediaOrder' => $mediaOrder,
|
'mediaOrder' => $mediaOrder,
|
||||||
'media' => Media::all(),
|
'media' => Media::all(),
|
||||||
'acceptedMedia' => $media,
|
'acceptedMedia' => $media,
|
||||||
'acceptedMediaNow' => $mediaOrder->media->pluck('id')
|
'acceptedMediaNow' => $mediaOrder->media->pluck('id'),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update(OrderRequest $request, $id){
|
public function update(OrderRequest $request, $id)
|
||||||
|
{
|
||||||
$validatedData = $request->validated();
|
$validatedData = $request->validated();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -122,7 +126,8 @@ public function update(OrderRequest $request, $id){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function accept(Request $request, $id){
|
public function accept(Request $request, $id)
|
||||||
|
{
|
||||||
if (! Auth::check() || Auth::user()->role_id !== 3) {
|
if (! Auth::check() || Auth::user()->role_id !== 3) {
|
||||||
return abort(403, 'Unauthorized action.');
|
return abort(403, 'Unauthorized action.');
|
||||||
}
|
}
|
||||||
@ -146,7 +151,7 @@ public function accept(Request $request, $id){
|
|||||||
$announcementData = [
|
$announcementData = [
|
||||||
'headline' => 'Media <u>'.$mediaOrder->name.'</u> telah <span class="text-primary">menerima</span> media order kerja sama <b>'.$order->cooperation->name.'</b>',
|
'headline' => 'Media <u>'.$mediaOrder->name.'</u> telah <span class="text-primary">menerima</span> media order kerja sama <b>'.$order->cooperation->name.'</b>',
|
||||||
'content' => 'Media <u>'.$mediaOrder->name.'</u> telah <span class="text-primary">menerima</span> media order kerja sama <u>'.$order->cooperation->name.'</u>',
|
'content' => 'Media <u>'.$mediaOrder->name.'</u> telah <span class="text-primary">menerima</span> media order kerja sama <u>'.$order->cooperation->name.'</u>',
|
||||||
'enhancer_id' => Auth::id()
|
'enhancer_id' => Auth::id(),
|
||||||
];
|
];
|
||||||
|
|
||||||
$adminIds = User::where('role_id', 1)->pluck('id')->mapWithKeys(function ($id) {
|
$adminIds = User::where('role_id', 1)->pluck('id')->mapWithKeys(function ($id) {
|
||||||
@ -167,7 +172,8 @@ public function accept(Request $request, $id){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function reject(Request $request, $id){
|
public function reject(Request $request, $id)
|
||||||
|
{
|
||||||
$validatedData = $request->validate([
|
$validatedData = $request->validate([
|
||||||
'rejection_reason' => ['required'],
|
'rejection_reason' => ['required'],
|
||||||
], [
|
], [
|
||||||
@ -189,7 +195,7 @@ public function reject(Request $request, $id){
|
|||||||
if ($mediaOrder->pivot->status == '0') {
|
if ($mediaOrder->pivot->status == '0') {
|
||||||
$affectedRows = $order->media()->updateExistingPivot($mediaOrder->id, [
|
$affectedRows = $order->media()->updateExistingPivot($mediaOrder->id, [
|
||||||
'status' => '2',
|
'status' => '2',
|
||||||
'rejection_reason' => $validatedData['rejection_reason']
|
'rejection_reason' => $validatedData['rejection_reason'],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Announcements
|
// Announcements
|
||||||
@ -198,7 +204,7 @@ public function reject(Request $request, $id){
|
|||||||
'content' => 'Media <u>'.$mediaOrder->name.'</u> <span class="text-danger">menolak</span> media order kerja sama <u>'.$order->cooperation->name.'</u>
|
'content' => 'Media <u>'.$mediaOrder->name.'</u> <span class="text-danger">menolak</span> media order kerja sama <u>'.$order->cooperation->name.'</u>
|
||||||
<p>Alasan: <br> '.$validatedData['rejection_reason'].'</p>
|
<p>Alasan: <br> '.$validatedData['rejection_reason'].'</p>
|
||||||
',
|
',
|
||||||
'enhancer_id' => Auth::id()
|
'enhancer_id' => Auth::id(),
|
||||||
];
|
];
|
||||||
|
|
||||||
$adminIds = User::where('role_id', 1)->pluck('id')->mapWithKeys(function ($id) {
|
$adminIds = User::where('role_id', 1)->pluck('id')->mapWithKeys(function ($id) {
|
||||||
|
|||||||
@ -8,7 +8,6 @@
|
|||||||
use App\Models\News;
|
use App\Models\News;
|
||||||
use Barryvdh\DomPDF\Facade\Pdf;
|
use Barryvdh\DomPDF\Facade\Pdf;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Auth;
|
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
@ -16,7 +15,8 @@
|
|||||||
|
|
||||||
class NewsController extends Controller
|
class NewsController extends Controller
|
||||||
{
|
{
|
||||||
public function index(Request $request){
|
public function index(Request $request)
|
||||||
|
{
|
||||||
return view('dashboard.news.index', [
|
return view('dashboard.news.index', [
|
||||||
'title' => 'Data Berita',
|
'title' => 'Data Berita',
|
||||||
'category' => $request->input('category', null),
|
'category' => $request->input('category', null),
|
||||||
@ -27,13 +27,15 @@ public function index(Request $request){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function create(){
|
public function create()
|
||||||
|
{
|
||||||
return view('dashboard.news.create', [
|
return view('dashboard.news.create', [
|
||||||
'title' => 'Buat Berita Baru'
|
'title' => 'Buat Berita Baru',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function store(NewsRequest $request){
|
public function store(NewsRequest $request)
|
||||||
|
{
|
||||||
// dd('hai');
|
// dd('hai');
|
||||||
$validatedData = $request->validated();
|
$validatedData = $request->validated();
|
||||||
|
|
||||||
@ -55,16 +57,18 @@ public function store(NewsRequest $request){
|
|||||||
return redirect()->route('dashboard.news.index')->with('success-status', 'Berhasil membuat berita baru.');
|
return redirect()->route('dashboard.news.index')->with('success-status', 'Berhasil membuat berita baru.');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function edit($id){
|
public function edit($id)
|
||||||
|
{
|
||||||
$news = News::findOrFail(decrypt_id($id));
|
$news = News::findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
return view('dashboard.news.edit', [
|
return view('dashboard.news.edit', [
|
||||||
'title' => 'Ubah Berita',
|
'title' => 'Ubah Berita',
|
||||||
'news' => $news
|
'news' => $news,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update(NewsRequest $request, $id){
|
public function update(NewsRequest $request, $id)
|
||||||
|
{
|
||||||
$validatedData = $request->validated();
|
$validatedData = $request->validated();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -93,12 +97,13 @@ public function update(NewsRequest $request, $id){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function show($id){
|
public function show($id)
|
||||||
|
{
|
||||||
$news = News::findOrFail(decrypt_id($id));
|
$news = News::findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
return view('dashboard.news.show', [
|
return view('dashboard.news.show', [
|
||||||
'title' => 'Detail Berita',
|
'title' => 'Detail Berita',
|
||||||
'news' => $news
|
'news' => $news,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,7 +111,7 @@ public function destroy($id)
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$news = News::findOrFail(decrypt_id($id));
|
$news = News::findOrFail(decrypt_id($id));
|
||||||
DB::transaction(function () use ($id, $news) {
|
DB::transaction(function () use ($news) {
|
||||||
|
|
||||||
$newSlug = Str::limit($news->slug.'-deleted-'.now()->timestamp, 191);
|
$newSlug = Str::limit($news->slug.'-deleted-'.now()->timestamp, 191);
|
||||||
|
|
||||||
@ -122,11 +127,11 @@ public function destroy($id)
|
|||||||
return response()->json(['message' => 'Berita tidak ditemukan.'], 404);
|
return response()->json(['message' => 'Berita tidak ditemukan.'], 404);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error('Gagal menghapus berita: '.$e->getMessage());
|
Log::error('Gagal menghapus berita: '.$e->getMessage());
|
||||||
|
|
||||||
return response()->json(['message' => 'Gagal menghapus berita.'], 500);
|
return response()->json(['message' => 'Gagal menghapus berita.'], 500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function export(Request $request)
|
public function export(Request $request)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -143,7 +148,8 @@ public function export(Request $request)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function filter(Request $request){
|
public function filter(Request $request)
|
||||||
|
{
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$filteredRequest = $request->except('_token');
|
$filteredRequest = $request->except('_token');
|
||||||
@ -157,10 +163,10 @@ public function filter(Request $request){
|
|||||||
return redirect()->back()->with('status-failed', 'Gagal melakukan proses filtering data.');
|
return redirect()->back()->with('status-failed', 'Gagal melakukan proses filtering data.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function printData($slug){
|
public function printData($slug)
|
||||||
|
{
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$news = News::where('slug', $slug)->first();
|
$news = News::where('slug', $slug)->first();
|
||||||
@ -179,7 +185,7 @@ public function checkLink(Request $request)
|
|||||||
$linkExists = News::where('link', $request->link)->exists();
|
$linkExists = News::where('link', $request->link)->exists();
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'exists' => $linkExists
|
'exists' => $linkExists,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,7 +22,7 @@ class OverviewController extends Controller
|
|||||||
public function index(Request $request)
|
public function index(Request $request)
|
||||||
{
|
{
|
||||||
$data = [
|
$data = [
|
||||||
'title' => 'Ikhtisar'
|
'title' => 'Ikhtisar',
|
||||||
];
|
];
|
||||||
|
|
||||||
$year = $request->input('year') ? $request->input('year') : Carbon::now()->year;
|
$year = $request->input('year') ? $request->input('year') : Carbon::now()->year;
|
||||||
@ -66,7 +66,6 @@ public function index(Request $request)
|
|||||||
$data['rejectedMediaOrder'] = $mediaOrder[2] ?? 0; // Status 2 = ditolak
|
$data['rejectedMediaOrder'] = $mediaOrder[2] ?? 0; // Status 2 = ditolak
|
||||||
// Akhir Statistik Media Order
|
// Akhir Statistik Media Order
|
||||||
|
|
||||||
|
|
||||||
// Statistik Rekap Konten
|
// Statistik Rekap Konten
|
||||||
$contentRecap = ContentRecap::all();
|
$contentRecap = ContentRecap::all();
|
||||||
$contentRecapCount = $contentRecap->groupBy('channel')->map(function ($group) {
|
$contentRecapCount = $contentRecap->groupBy('channel')->map(function ($group) {
|
||||||
@ -184,7 +183,6 @@ public function index(Request $request)
|
|||||||
$data['rejectedMediaOrder'] = $mediaOrder[2] ?? 0; // Status 2 = ditolak
|
$data['rejectedMediaOrder'] = $mediaOrder[2] ?? 0; // Status 2 = ditolak
|
||||||
// Akhir Statistik Media Order
|
// Akhir Statistik Media Order
|
||||||
|
|
||||||
|
|
||||||
// Statistik Rekap Konten
|
// Statistik Rekap Konten
|
||||||
$contentRecap = ContentRecap::all();
|
$contentRecap = ContentRecap::all();
|
||||||
$contentRecapCount = $contentRecap->groupBy('channel')->map(function ($group) {
|
$contentRecapCount = $contentRecap->groupBy('channel')->map(function ($group) {
|
||||||
|
|||||||
@ -16,8 +16,8 @@
|
|||||||
|
|
||||||
class ReportController extends Controller
|
class ReportController extends Controller
|
||||||
{
|
{
|
||||||
|
public function index(Request $request)
|
||||||
public function index(Request $request){
|
{
|
||||||
return view('dashboard.reports.index', [
|
return view('dashboard.reports.index', [
|
||||||
'title' => 'Laporan Bukti Tayang',
|
'title' => 'Laporan Bukti Tayang',
|
||||||
'mediaCollection' => Media::all(),
|
'mediaCollection' => Media::all(),
|
||||||
@ -30,14 +30,16 @@ public function index(Request $request){
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function create($id){
|
public function create($id)
|
||||||
|
{
|
||||||
return view('dashboard.reports.create', [
|
return view('dashboard.reports.create', [
|
||||||
'title' => 'Buat Laporan',
|
'title' => 'Buat Laporan',
|
||||||
'mediaOrderId' => $id
|
'mediaOrderId' => $id,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function store(ReportRequest $request, $id){
|
public function store(ReportRequest $request, $id)
|
||||||
|
{
|
||||||
$validatedData = $request->validated();
|
$validatedData = $request->validated();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -53,17 +55,19 @@ public function store(ReportRequest $request, $id){
|
|||||||
return redirect()->route('dashboard.cooperations.process', ['id' => $id, 'process' => 'reports'])->with('success-status', 'Berhasil menambahkan laporan.');
|
return redirect()->route('dashboard.cooperations.process', ['id' => $id, 'process' => 'reports'])->with('success-status', 'Berhasil menambahkan laporan.');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function edit($mediaOrderId, $id){
|
public function edit($mediaOrderId, $id)
|
||||||
|
{
|
||||||
$report = Report::findOrFail(decrypt_id($id));
|
$report = Report::findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
return view('dashboard.reports.edit', [
|
return view('dashboard.reports.edit', [
|
||||||
'title' => 'Buat Laporan',
|
'title' => 'Buat Laporan',
|
||||||
'report' => $report,
|
'report' => $report,
|
||||||
'mediaOrderId' => $mediaOrderId
|
'mediaOrderId' => $mediaOrderId,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update(ReportRequest $request, $mediaOrderId, $id){
|
public function update(ReportRequest $request, $mediaOrderId, $id)
|
||||||
|
{
|
||||||
$validatedData = $request->validated();
|
$validatedData = $request->validated();
|
||||||
$validatedData['media_id'] = Auth::user()->company->media->id;
|
$validatedData['media_id'] = Auth::user()->company->media->id;
|
||||||
$validatedData['order_id'] = decrypt_id($mediaOrderId);
|
$validatedData['order_id'] = decrypt_id($mediaOrderId);
|
||||||
@ -92,46 +96,50 @@ public function update(ReportRequest $request, $mediaOrderId, $id){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function show($mediaOrderId, $id){
|
public function show($mediaOrderId, $id)
|
||||||
|
{
|
||||||
$report = Report::findOrFail(decrypt_id($id));
|
$report = Report::findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
return view('dashboard.reports.show', [
|
return view('dashboard.reports.show', [
|
||||||
'title' => 'Detail Laporan',
|
'title' => 'Detail Laporan',
|
||||||
'report' => $report,
|
'report' => $report,
|
||||||
'mediaOrderId' => $mediaOrderId
|
'mediaOrderId' => $mediaOrderId,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function showIndex($id){
|
public function showIndex($id)
|
||||||
|
{
|
||||||
$report = Report::findOrFail(decrypt_id($id));
|
$report = Report::findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
return view('dashboard.reports.index.show', [
|
return view('dashboard.reports.index.show', [
|
||||||
'title' => 'Detail Penyelesaian Kerja Sama',
|
'title' => 'Detail Penyelesaian Kerja Sama',
|
||||||
'report' => $report
|
'report' => $report,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function processIndex($id){
|
public function processIndex($id)
|
||||||
|
{
|
||||||
$report = Report::findOrFail(decrypt_id($id));
|
$report = Report::findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
return view('dashboard.reports.index.process', [
|
return view('dashboard.reports.index.process', [
|
||||||
'title' => 'Detail Penyelesaian Kerja Sama',
|
'title' => 'Detail Penyelesaian Kerja Sama',
|
||||||
'report' => $report
|
'report' => $report,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function accept($id){
|
public function accept($id)
|
||||||
|
{
|
||||||
$report = Report::findOrFail(decrypt_id($id));
|
$report = Report::findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
$acceptedReport = $report->update([
|
$acceptedReport = $report->update([
|
||||||
'status' => '1'
|
'status' => '1',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Announcements
|
// Announcements
|
||||||
$announcementData = [
|
$announcementData = [
|
||||||
'headline' => 'Laporan bukti tayang kerja sama <u>'.$report->order->cooperation->name.'</u> telah <span class="text-primary">disetujui</span>',
|
'headline' => 'Laporan bukti tayang kerja sama <u>'.$report->order->cooperation->name.'</u> telah <span class="text-primary">disetujui</span>',
|
||||||
'content' => '<p>Admin telah menyetujui laporan bukti tayang Anda.</p>',
|
'content' => '<p>Admin telah menyetujui laporan bukti tayang Anda.</p>',
|
||||||
'enhancer_id' => Auth::id()
|
'enhancer_id' => Auth::id(),
|
||||||
];
|
];
|
||||||
$createdAnnouncement = Announcement::create($announcementData);
|
$createdAnnouncement = Announcement::create($announcementData);
|
||||||
$createdAnnouncement->users()->attach($report->media->company->user->id, ['category' => 'system']);
|
$createdAnnouncement->users()->attach($report->media->company->user->id, ['category' => 'system']);
|
||||||
@ -144,17 +152,19 @@ public function accept($id){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function reject($mediaOrderId, $id){
|
public function reject($mediaOrderId, $id)
|
||||||
|
{
|
||||||
$report = Report::findOrFail(decrypt_id($id));
|
$report = Report::findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
return view('dashboard.reports.reject', [
|
return view('dashboard.reports.reject', [
|
||||||
'title' => 'Tolak Laporan',
|
'title' => 'Tolak Laporan',
|
||||||
'report' => $report,
|
'report' => $report,
|
||||||
'mediaOrderId' => $mediaOrderId
|
'mediaOrderId' => $mediaOrderId,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function rejectAction(Request $request, $mediaOrderId, $id){
|
public function rejectAction(Request $request, $mediaOrderId, $id)
|
||||||
|
{
|
||||||
$validatedData = $request->validate([
|
$validatedData = $request->validate([
|
||||||
'rejection_reason' => ['required'],
|
'rejection_reason' => ['required'],
|
||||||
], [
|
], [
|
||||||
@ -166,14 +176,14 @@ public function rejectAction(Request $request, $mediaOrderId, $id){
|
|||||||
|
|
||||||
$rejectedReport = $report->update([
|
$rejectedReport = $report->update([
|
||||||
'status' => '2',
|
'status' => '2',
|
||||||
'rejection_reason' => $validatedData['rejection_reason']
|
'rejection_reason' => $validatedData['rejection_reason'],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Announcements
|
// Announcements
|
||||||
$announcementData = [
|
$announcementData = [
|
||||||
'headline' => 'Laporan bukti tayang kerja sama <u>'.$report->order->cooperation->name.'</u> telah <span class="text-danger">ditolak</span>',
|
'headline' => 'Laporan bukti tayang kerja sama <u>'.$report->order->cooperation->name.'</u> telah <span class="text-danger">ditolak</span>',
|
||||||
'content' => '<p>Admin telah menolak laporan bukti tayang Anda.</p>',
|
'content' => '<p>Admin telah menolak laporan bukti tayang Anda.</p>',
|
||||||
'enhancer_id' => Auth::id()
|
'enhancer_id' => Auth::id(),
|
||||||
];
|
];
|
||||||
$createdAnnouncement = Announcement::create($announcementData);
|
$createdAnnouncement = Announcement::create($announcementData);
|
||||||
$createdAnnouncement->users()->attach($report->media->company->user->id, ['category' => 'system']);
|
$createdAnnouncement->users()->attach($report->media->company->user->id, ['category' => 'system']);
|
||||||
@ -189,7 +199,8 @@ public function rejectAction(Request $request, $mediaOrderId, $id){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function rejectActionIndex(Request $request, $id){
|
public function rejectActionIndex(Request $request, $id)
|
||||||
|
{
|
||||||
$validatedData = $request->validate([
|
$validatedData = $request->validate([
|
||||||
'rejection_reason' => ['required'],
|
'rejection_reason' => ['required'],
|
||||||
], [
|
], [
|
||||||
@ -201,14 +212,14 @@ public function rejectActionIndex(Request $request, $id){
|
|||||||
|
|
||||||
$rejectedReport = $report->update([
|
$rejectedReport = $report->update([
|
||||||
'status' => '2',
|
'status' => '2',
|
||||||
'rejection_reason' => $validatedData['rejection_reason']
|
'rejection_reason' => $validatedData['rejection_reason'],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Announcements
|
// Announcements
|
||||||
$announcementData = [
|
$announcementData = [
|
||||||
'headline' => 'Laporan bukti tayang kerja sama <u>'.$report->order->cooperation->name.'</u> telah <span class="text-danger">ditolak</span>',
|
'headline' => 'Laporan bukti tayang kerja sama <u>'.$report->order->cooperation->name.'</u> telah <span class="text-danger">ditolak</span>',
|
||||||
'content' => '<p>Admin telah menolak laporan bukti tayang Anda.</p>',
|
'content' => '<p>Admin telah menolak laporan bukti tayang Anda.</p>',
|
||||||
'enhancer_id' => Auth::id()
|
'enhancer_id' => Auth::id(),
|
||||||
];
|
];
|
||||||
$createdAnnouncement = Announcement::create($announcementData);
|
$createdAnnouncement = Announcement::create($announcementData);
|
||||||
$createdAnnouncement->users()->attach($report->media->company->user->id, ['category' => 'system']);
|
$createdAnnouncement->users()->attach($report->media->company->user->id, ['category' => 'system']);
|
||||||
@ -224,13 +235,13 @@ public function rejectActionIndex(Request $request, $id){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function destroy($id){
|
public function destroy($id)
|
||||||
|
{
|
||||||
try {
|
try {
|
||||||
$report = Report::findOrFail(decrypt_id($id));
|
$report = Report::findOrFail(decrypt_id($id));
|
||||||
delete_file('app/public/uploads/reports/'.$report->proof);
|
delete_file('app/public/uploads/reports/'.$report->proof);
|
||||||
$report->forceDelete();
|
$report->forceDelete();
|
||||||
|
|
||||||
|
|
||||||
return response()->json(['message' => 'Berhasil menghapus laporan bukti tayang.']);
|
return response()->json(['message' => 'Berhasil menghapus laporan bukti tayang.']);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return response()->json(['message' => 'Gagal menghapus laporan bukti tayang.'], 500);
|
return response()->json(['message' => 'Gagal menghapus laporan bukti tayang.'], 500);
|
||||||
@ -244,7 +255,7 @@ public function checkLink(Request $request)
|
|||||||
->exists();
|
->exists();
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'exists' => $linkExists
|
'exists' => $linkExists,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -262,6 +273,7 @@ public function export(Request $request)
|
|||||||
|
|
||||||
if ($export_type === 'excel') {
|
if ($export_type === 'excel') {
|
||||||
$formattedNow = Carbon::parse(now())->locale('id')->translatedFormat('d-m-Y');
|
$formattedNow = Carbon::parse(now())->locale('id')->translatedFormat('d-m-Y');
|
||||||
|
|
||||||
return Excel::download(new ReportExport($media, $status, $year, $from_month, $to_month, $date), 'reports-'.$formattedNow.'.xlsx');
|
return Excel::download(new ReportExport($media, $status, $year, $from_month, $to_month, $date), 'reports-'.$formattedNow.'.xlsx');
|
||||||
} elseif ($export_type === 'pdf') {
|
} elseif ($export_type === 'pdf') {
|
||||||
if (is_role(['1', '5'])) {
|
if (is_role(['1', '5'])) {
|
||||||
@ -317,7 +329,8 @@ public function export(Request $request)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function singlePrint(){
|
public function singlePrint()
|
||||||
|
{
|
||||||
try {
|
try {
|
||||||
$report = Report::with(['media.company', 'order.cooperation'])->first();
|
$report = Report::with(['media.company', 'order.cooperation'])->first();
|
||||||
|
|
||||||
|
|||||||
@ -3,13 +3,13 @@
|
|||||||
namespace App\Http\Controllers\Dashboard;
|
namespace App\Http\Controllers\Dashboard;
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use Illuminate\Http\Request;
|
|
||||||
|
|
||||||
class RoleController extends Controller
|
class RoleController extends Controller
|
||||||
{
|
{
|
||||||
public function index(){
|
public function index()
|
||||||
|
{
|
||||||
return view('dashboard.role.index', [
|
return view('dashboard.role.index', [
|
||||||
'title' => 'Role Pengguna'
|
'title' => 'Role Pengguna',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,11 +5,11 @@
|
|||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Http\Requests\SettingRequest;
|
use App\Http\Requests\SettingRequest;
|
||||||
use App\Settings\AppSettings;
|
use App\Settings\AppSettings;
|
||||||
use Illuminate\Http\Request;
|
|
||||||
|
|
||||||
class SettingController extends Controller
|
class SettingController extends Controller
|
||||||
{
|
{
|
||||||
public function index(){
|
public function index()
|
||||||
|
{
|
||||||
return view('dashboard.setting.index', [
|
return view('dashboard.setting.index', [
|
||||||
'title' => 'Pengaturan Aplikasi',
|
'title' => 'Pengaturan Aplikasi',
|
||||||
]);
|
]);
|
||||||
@ -62,5 +62,4 @@ public function update(SettingRequest $request)
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,17 +15,17 @@
|
|||||||
use Barryvdh\DomPDF\Facade\Pdf;
|
use Barryvdh\DomPDF\Facade\Pdf;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\DB;
|
|
||||||
|
|
||||||
class StatisticController extends Controller
|
class StatisticController extends Controller
|
||||||
{
|
{
|
||||||
public function index(Request $request){
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
|
||||||
$statistics = [
|
$statistics = [
|
||||||
[
|
[
|
||||||
'name' => 'Aktivitas Login',
|
'name' => 'Aktivitas Login',
|
||||||
'category' => 'login-activities',
|
'category' => 'login-activities',
|
||||||
'is_available' => true
|
'is_available' => true,
|
||||||
],
|
],
|
||||||
// [
|
// [
|
||||||
// 'name' => 'Jurnalis',
|
// 'name' => 'Jurnalis',
|
||||||
@ -35,12 +35,12 @@ public function index(Request $request){
|
|||||||
[
|
[
|
||||||
'name' => 'Kerja Sama Media',
|
'name' => 'Kerja Sama Media',
|
||||||
'category' => 'media-cooperations',
|
'category' => 'media-cooperations',
|
||||||
'is_available' => true
|
'is_available' => true,
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'name' => 'Laporan Bukti Tayang',
|
'name' => 'Laporan Bukti Tayang',
|
||||||
'category' => 'airing-proof-reports',
|
'category' => 'airing-proof-reports',
|
||||||
'is_available' => true
|
'is_available' => true,
|
||||||
],
|
],
|
||||||
// [
|
// [
|
||||||
// 'name' => 'Media',
|
// 'name' => 'Media',
|
||||||
@ -50,17 +50,17 @@ public function index(Request $request){
|
|||||||
[
|
[
|
||||||
'name' => 'Monitoring Media & Manajemen Isu',
|
'name' => 'Monitoring Media & Manajemen Isu',
|
||||||
'category' => 'media-monitorings-issue-management',
|
'category' => 'media-monitorings-issue-management',
|
||||||
'is_available' => true
|
'is_available' => true,
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'name' => 'Penyelesaian Kerja Sama',
|
'name' => 'Penyelesaian Kerja Sama',
|
||||||
'category' => 'cooperation-completions',
|
'category' => 'cooperation-completions',
|
||||||
'is_available' => true
|
'is_available' => true,
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'name' => 'Pengguna',
|
'name' => 'Pengguna',
|
||||||
'category' => 'users',
|
'category' => 'users',
|
||||||
'is_available' => true
|
'is_available' => true,
|
||||||
],
|
],
|
||||||
// [
|
// [
|
||||||
// 'name' => 'Perusahaan',
|
// 'name' => 'Perusahaan',
|
||||||
@ -70,23 +70,23 @@ public function index(Request $request){
|
|||||||
[
|
[
|
||||||
'name' => 'Rekap Konten',
|
'name' => 'Rekap Konten',
|
||||||
'category' => 'content-recaps',
|
'category' => 'content-recaps',
|
||||||
'is_available' => true
|
'is_available' => true,
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'name' => 'Pengunjung Website',
|
'name' => 'Pengunjung Website',
|
||||||
'category' => 'website-visitors',
|
'category' => 'website-visitors',
|
||||||
'is_available' => true
|
'is_available' => true,
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
return view('dashboard.statistics.index', [
|
return view('dashboard.statistics.index', [
|
||||||
'title' => 'Statistik',
|
'title' => 'Statistik',
|
||||||
'statistics' => $statistics
|
'statistics' => $statistics,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function show(Request $request, $category){
|
public function show(Request $request, $category)
|
||||||
|
{
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'category' => $category,
|
'category' => $category,
|
||||||
@ -320,7 +320,6 @@ public function show(Request $request, $category){
|
|||||||
$issues = $issues->get();
|
$issues = $issues->get();
|
||||||
$mediaMonitorings = $mediaMonitorings->get();
|
$mediaMonitorings = $mediaMonitorings->get();
|
||||||
|
|
||||||
|
|
||||||
$issueCounts = $issues->groupBy('issue')->map(function ($group) {
|
$issueCounts = $issues->groupBy('issue')->map(function ($group) {
|
||||||
return $group->count();
|
return $group->count();
|
||||||
});
|
});
|
||||||
@ -613,7 +612,8 @@ public function show(Request $request, $category){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function export(Request $request, $category){
|
public function export(Request $request, $category)
|
||||||
|
{
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'category' => $category,
|
'category' => $category,
|
||||||
@ -653,6 +653,7 @@ public function export(Request $request, $category){
|
|||||||
$data['loginActivities'] = $monthlyCount;
|
$data['loginActivities'] = $monthlyCount;
|
||||||
|
|
||||||
$pdf = Pdf::loadView('dashboard.statistics.exports.pdf.login-activity', $data);
|
$pdf = Pdf::loadView('dashboard.statistics.exports.pdf.login-activity', $data);
|
||||||
|
|
||||||
return $pdf->stream('aktivitas-login-'.$data['year'].'.pdf');
|
return $pdf->stream('aktivitas-login-'.$data['year'].'.pdf');
|
||||||
case 'media-cooperations':
|
case 'media-cooperations':
|
||||||
$data['title'] = 'Statistik Kerja Sama Media';
|
$data['title'] = 'Statistik Kerja Sama Media';
|
||||||
@ -732,6 +733,7 @@ public function export(Request $request, $category){
|
|||||||
// dd($data);
|
// dd($data);
|
||||||
|
|
||||||
$pdf = Pdf::loadView('dashboard.statistics.exports.pdf.media-cooperation', $data);
|
$pdf = Pdf::loadView('dashboard.statistics.exports.pdf.media-cooperation', $data);
|
||||||
|
|
||||||
return $pdf->stream('kerja-sama-media.pdf');
|
return $pdf->stream('kerja-sama-media.pdf');
|
||||||
case 'airing-proof-reports':
|
case 'airing-proof-reports':
|
||||||
$data['title'] = 'Statistik Laporan Bukti Tayang';
|
$data['title'] = 'Statistik Laporan Bukti Tayang';
|
||||||
@ -809,6 +811,7 @@ public function export(Request $request, $category){
|
|||||||
$data['airingProofReportRejected'] = $airingProofReportCount->get('2', 0);
|
$data['airingProofReportRejected'] = $airingProofReportCount->get('2', 0);
|
||||||
|
|
||||||
$pdf = Pdf::loadView('dashboard.statistics.exports.pdf.airing-proof-report', $data);
|
$pdf = Pdf::loadView('dashboard.statistics.exports.pdf.airing-proof-report', $data);
|
||||||
|
|
||||||
return $pdf->stream('laporan-bukti-tayang.pdf');
|
return $pdf->stream('laporan-bukti-tayang.pdf');
|
||||||
case 'media-monitorings-issue-management':
|
case 'media-monitorings-issue-management':
|
||||||
$data['title'] = 'Statistik Monitoring Media & Manajemen Isu';
|
$data['title'] = 'Statistik Monitoring Media & Manajemen Isu';
|
||||||
@ -844,7 +847,6 @@ public function export(Request $request, $category){
|
|||||||
$issues = $issues->get();
|
$issues = $issues->get();
|
||||||
$mediaMonitorings = $mediaMonitorings->get();
|
$mediaMonitorings = $mediaMonitorings->get();
|
||||||
|
|
||||||
|
|
||||||
$issueCounts = $issues->groupBy('issue')->map(function ($group) {
|
$issueCounts = $issues->groupBy('issue')->map(function ($group) {
|
||||||
return $group->count();
|
return $group->count();
|
||||||
});
|
});
|
||||||
@ -915,6 +917,7 @@ public function export(Request $request, $category){
|
|||||||
$data['issueManagementMonthly'] = $issueManagementMonthly;
|
$data['issueManagementMonthly'] = $issueManagementMonthly;
|
||||||
|
|
||||||
$pdf = Pdf::loadView('dashboard.statistics.exports.pdf.media-monitoring-issue-management', $data);
|
$pdf = Pdf::loadView('dashboard.statistics.exports.pdf.media-monitoring-issue-management', $data);
|
||||||
|
|
||||||
return $pdf->stream('monitoring-media-manajemen-isu.pdf');
|
return $pdf->stream('monitoring-media-manajemen-isu.pdf');
|
||||||
case 'cooperation-completions':
|
case 'cooperation-completions':
|
||||||
$data['title'] = 'Statistik Penyelesaian Kerja Sama';
|
$data['title'] = 'Statistik Penyelesaian Kerja Sama';
|
||||||
@ -992,6 +995,7 @@ public function export(Request $request, $category){
|
|||||||
$data['cooperationCompletionRejected'] = $cooperationCompletionCount->get('2', 0);
|
$data['cooperationCompletionRejected'] = $cooperationCompletionCount->get('2', 0);
|
||||||
|
|
||||||
$pdf = Pdf::loadView('dashboard.statistics.exports.pdf.cooperation-completion', $data);
|
$pdf = Pdf::loadView('dashboard.statistics.exports.pdf.cooperation-completion', $data);
|
||||||
|
|
||||||
return $pdf->stream('penyelesaian-kerja-sama.pdf');
|
return $pdf->stream('penyelesaian-kerja-sama.pdf');
|
||||||
case 'users':
|
case 'users':
|
||||||
$data['title'] = 'Statistik Pengguna';
|
$data['title'] = 'Statistik Pengguna';
|
||||||
@ -1033,6 +1037,7 @@ public function export(Request $request, $category){
|
|||||||
$data['registerUserMonth'] = $monthlyCount;
|
$data['registerUserMonth'] = $monthlyCount;
|
||||||
|
|
||||||
$pdf = Pdf::loadView('dashboard.statistics.exports.pdf.user', $data);
|
$pdf = Pdf::loadView('dashboard.statistics.exports.pdf.user', $data);
|
||||||
|
|
||||||
return $pdf->stream('pengguna.pdf');
|
return $pdf->stream('pengguna.pdf');
|
||||||
case 'content-recaps':
|
case 'content-recaps':
|
||||||
$data['title'] = 'Statistik Rekap Konten';
|
$data['title'] = 'Statistik Rekap Konten';
|
||||||
@ -1095,6 +1100,7 @@ public function export(Request $request, $category){
|
|||||||
$data['socialMedia3ContentRecap'] = $contentRecapSocialMediaCount->get('Purwakarta Saber Hoaks', 0);
|
$data['socialMedia3ContentRecap'] = $contentRecapSocialMediaCount->get('Purwakarta Saber Hoaks', 0);
|
||||||
|
|
||||||
$pdf = Pdf::loadView('dashboard.statistics.exports.pdf.content-recap', $data);
|
$pdf = Pdf::loadView('dashboard.statistics.exports.pdf.content-recap', $data);
|
||||||
|
|
||||||
return $pdf->stream('rekap-konten.pdf');
|
return $pdf->stream('rekap-konten.pdf');
|
||||||
case 'website-visitors':
|
case 'website-visitors':
|
||||||
$data['title'] = 'Statistik Pengunjung Website';
|
$data['title'] = 'Statistik Pengunjung Website';
|
||||||
@ -1136,6 +1142,7 @@ public function export(Request $request, $category){
|
|||||||
$data['websiteVisitorMonth'] = $monthlyCount;
|
$data['websiteVisitorMonth'] = $monthlyCount;
|
||||||
|
|
||||||
$pdf = Pdf::loadView('dashboard.statistics.exports.pdf.website-visitor', $data);
|
$pdf = Pdf::loadView('dashboard.statistics.exports.pdf.website-visitor', $data);
|
||||||
|
|
||||||
return $pdf->stream('pengunjung-aplikasi.pdf');
|
return $pdf->stream('pengunjung-aplikasi.pdf');
|
||||||
default:
|
default:
|
||||||
abort(404);
|
abort(404);
|
||||||
|
|||||||
@ -7,12 +7,11 @@
|
|||||||
use App\Models\Classification;
|
use App\Models\Classification;
|
||||||
use App\Models\SubClassification;
|
use App\Models\SubClassification;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Auth;
|
|
||||||
use Illuminate\Support\Str;
|
|
||||||
|
|
||||||
class SubClassificationController extends Controller
|
class SubClassificationController extends Controller
|
||||||
{
|
{
|
||||||
public function index(Request $request){
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
|
||||||
$viewData = [
|
$viewData = [
|
||||||
'title' => 'Data Sub Klasifikasi',
|
'title' => 'Data Sub Klasifikasi',
|
||||||
@ -24,11 +23,12 @@ public function index(Request $request){
|
|||||||
return view('dashboard.sub-classifications.index', $viewData);
|
return view('dashboard.sub-classifications.index', $viewData);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function create(Request $request){
|
public function create(Request $request)
|
||||||
|
{
|
||||||
|
|
||||||
$viewData = [
|
$viewData = [
|
||||||
'title' => 'Buat Sub Klasifikasi Baru',
|
'title' => 'Buat Sub Klasifikasi Baru',
|
||||||
'fromClassification' => false
|
'fromClassification' => false,
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($request->has('classification')) {
|
if ($request->has('classification')) {
|
||||||
@ -42,7 +42,8 @@ public function create(Request $request){
|
|||||||
return view('dashboard.sub-classifications.create', $viewData);
|
return view('dashboard.sub-classifications.create', $viewData);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function store(SubClassificationRequest $request){
|
public function store(SubClassificationRequest $request)
|
||||||
|
{
|
||||||
$validatedData = $request->validated();
|
$validatedData = $request->validated();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -55,17 +56,19 @@ public function store(SubClassificationRequest $request){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function edit($id){
|
public function edit($id)
|
||||||
|
{
|
||||||
$subClassification = SubClassification::findOrFail(decrypt_id($id));
|
$subClassification = SubClassification::findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
return view('dashboard.sub-classifications.edit', [
|
return view('dashboard.sub-classifications.edit', [
|
||||||
'title' => 'Ubah Sub Klasifikasi',
|
'title' => 'Ubah Sub Klasifikasi',
|
||||||
'subClassification' => $subClassification,
|
'subClassification' => $subClassification,
|
||||||
'classifications' => Classification::all()
|
'classifications' => Classification::all(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update(SubClassificationRequest $request, $id){
|
public function update(SubClassificationRequest $request, $id)
|
||||||
|
{
|
||||||
$validatedData = $request->validated();
|
$validatedData = $request->validated();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -78,7 +81,8 @@ public function update(SubClassificationRequest $request, $id){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function show($id){
|
public function show($id)
|
||||||
|
{
|
||||||
$subClassification = SubClassification::with(['classification'])->withTrashed()->findOrFail(decrypt_id($id));
|
$subClassification = SubClassification::with(['classification'])->withTrashed()->findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
return view('dashboard.sub-classifications.show', [
|
return view('dashboard.sub-classifications.show', [
|
||||||
@ -87,7 +91,8 @@ public function show($id){
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function destroy($id){
|
public function destroy($id)
|
||||||
|
{
|
||||||
try {
|
try {
|
||||||
$subClassification = SubClassification::findOrFail(decrypt_id($id));
|
$subClassification = SubClassification::findOrFail(decrypt_id($id));
|
||||||
$subClassification->delete();
|
$subClassification->delete();
|
||||||
|
|||||||
@ -7,12 +7,11 @@
|
|||||||
use App\Models\Location;
|
use App\Models\Location;
|
||||||
use App\Models\SubLocation;
|
use App\Models\SubLocation;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Auth;
|
|
||||||
use Illuminate\Support\Str;
|
|
||||||
|
|
||||||
class SubLocationController extends Controller
|
class SubLocationController extends Controller
|
||||||
{
|
{
|
||||||
public function index(Request $request){
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
|
||||||
$viewData = [
|
$viewData = [
|
||||||
'title' => 'Data Sub Lokus',
|
'title' => 'Data Sub Lokus',
|
||||||
@ -23,11 +22,12 @@ public function index(Request $request){
|
|||||||
return view('dashboard.sub-locations.index', $viewData);
|
return view('dashboard.sub-locations.index', $viewData);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function create(Request $request){
|
public function create(Request $request)
|
||||||
|
{
|
||||||
|
|
||||||
$viewData = [
|
$viewData = [
|
||||||
'title' => 'Buat Sub Lokus Baru',
|
'title' => 'Buat Sub Lokus Baru',
|
||||||
'fromLocation' => false
|
'fromLocation' => false,
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($request->has('location')) {
|
if ($request->has('location')) {
|
||||||
@ -41,7 +41,8 @@ public function create(Request $request){
|
|||||||
return view('dashboard.sub-locations.create', $viewData);
|
return view('dashboard.sub-locations.create', $viewData);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function store(SubLocationRequest $request){
|
public function store(SubLocationRequest $request)
|
||||||
|
{
|
||||||
$validatedData = $request->validated();
|
$validatedData = $request->validated();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -54,17 +55,19 @@ public function store(SubLocationRequest $request){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function edit($id){
|
public function edit($id)
|
||||||
|
{
|
||||||
$subLocation = SubLocation::findOrFail(decrypt_id($id));
|
$subLocation = SubLocation::findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
return view('dashboard.sub-locations.edit', [
|
return view('dashboard.sub-locations.edit', [
|
||||||
'title' => 'Ubah Sub Lokus',
|
'title' => 'Ubah Sub Lokus',
|
||||||
'subLocation' => $subLocation,
|
'subLocation' => $subLocation,
|
||||||
'locations' => Location::all()
|
'locations' => Location::all(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update(SubLocationRequest $request, $id){
|
public function update(SubLocationRequest $request, $id)
|
||||||
|
{
|
||||||
$validatedData = $request->validated();
|
$validatedData = $request->validated();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -77,7 +80,8 @@ public function update(SubLocationRequest $request, $id){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function show($id){
|
public function show($id)
|
||||||
|
{
|
||||||
$subLocation = SubLocation::with(['location'])->findOrFail(decrypt_id($id));
|
$subLocation = SubLocation::with(['location'])->findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
return view('dashboard.sub-locations.show', [
|
return view('dashboard.sub-locations.show', [
|
||||||
@ -86,7 +90,8 @@ public function show($id){
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function destroy($id){
|
public function destroy($id)
|
||||||
|
{
|
||||||
try {
|
try {
|
||||||
$subLocation = SubLocation::findOrFail(decrypt_id($id));
|
$subLocation = SubLocation::findOrFail(decrypt_id($id));
|
||||||
$subLocation->delete();
|
$subLocation->delete();
|
||||||
|
|||||||
@ -17,7 +17,8 @@
|
|||||||
|
|
||||||
class UserController extends Controller
|
class UserController extends Controller
|
||||||
{
|
{
|
||||||
public function index(Request $request){
|
public function index(Request $request)
|
||||||
|
{
|
||||||
return view('dashboard.users.index', [
|
return view('dashboard.users.index', [
|
||||||
'title' => 'Data Pengguna',
|
'title' => 'Data Pengguna',
|
||||||
'role' => $request->input('role', null),
|
'role' => $request->input('role', null),
|
||||||
@ -25,14 +26,16 @@ public function index(Request $request){
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function create(){
|
public function create()
|
||||||
|
{
|
||||||
return view('dashboard.users.create', [
|
return view('dashboard.users.create', [
|
||||||
'title' => 'Buat Pengguna Baru',
|
'title' => 'Buat Pengguna Baru',
|
||||||
'roles' => Role::all()
|
'roles' => Role::all(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function store(UserRequest $request){
|
public function store(UserRequest $request)
|
||||||
|
{
|
||||||
$validatedData = $request->validated();
|
$validatedData = $request->validated();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -45,17 +48,19 @@ public function store(UserRequest $request){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function edit($id){
|
public function edit($id)
|
||||||
|
{
|
||||||
$user = User::with(['role'])->findOrFail(decrypt_id($id));
|
$user = User::with(['role'])->findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
return view('dashboard.users.edit', [
|
return view('dashboard.users.edit', [
|
||||||
'title' => 'Ubah Pengguna',
|
'title' => 'Ubah Pengguna',
|
||||||
'user' => $user,
|
'user' => $user,
|
||||||
'roles' => Role::all()
|
'roles' => Role::all(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update(UserRequest $request, $id){
|
public function update(UserRequest $request, $id)
|
||||||
|
{
|
||||||
$validatedData = $request->validated();
|
$validatedData = $request->validated();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -68,7 +73,8 @@ public function update(UserRequest $request, $id){
|
|||||||
return redirect()->back()->with('success-status', 'Berhasil mengubah pengguna.');
|
return redirect()->back()->with('success-status', 'Berhasil mengubah pengguna.');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function show($id, $type){
|
public function show($id, $type)
|
||||||
|
{
|
||||||
$user = User::with(['role', 'company.media.journalists'])->findOrFail(decrypt_id($id));
|
$user = User::with(['role', 'company.media.journalists'])->findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
@ -76,7 +82,7 @@ public function show($id, $type){
|
|||||||
'user' => $user,
|
'user' => $user,
|
||||||
'roles' => Role::all(),
|
'roles' => Role::all(),
|
||||||
'page' => 'show-user',
|
'page' => 'show-user',
|
||||||
'type' => $type
|
'type' => $type,
|
||||||
];
|
];
|
||||||
|
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
@ -85,6 +91,7 @@ public function show($id, $type){
|
|||||||
|
|
||||||
case 'login-activities':
|
case 'login-activities':
|
||||||
$data['loginActivities'] = LoginHistory::where('user_id', $user->id)->orderByDesc('id')->simplePaginate(20);
|
$data['loginActivities'] = LoginHistory::where('user_id', $user->id)->orderByDesc('id')->simplePaginate(20);
|
||||||
|
|
||||||
return view('dashboard.users.profiles.login-activity', $data);
|
return view('dashboard.users.profiles.login-activity', $data);
|
||||||
|
|
||||||
case 'company':
|
case 'company':
|
||||||
@ -102,22 +109,24 @@ public function show($id, $type){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function resetPassword($id){
|
public function resetPassword($id)
|
||||||
|
{
|
||||||
$user = User::with(['role'])->findOrFail(decrypt_id($id));
|
$user = User::with(['role'])->findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
return view('dashboard.users.reset-password', [
|
return view('dashboard.users.reset-password', [
|
||||||
'title' => 'Reset Password',
|
'title' => 'Reset Password',
|
||||||
'page' => 'reset',
|
'page' => 'reset',
|
||||||
'user' => $user
|
'user' => $user,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function resetPasswordAction(ResetPasswordRequest $request, $id){
|
public function resetPasswordAction(ResetPasswordRequest $request, $id)
|
||||||
|
{
|
||||||
$validatedData = $request->validated();
|
$validatedData = $request->validated();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
User::findOrFail(decrypt_id($id))->update([
|
User::findOrFail(decrypt_id($id))->update([
|
||||||
'password' => $validatedData['password']
|
'password' => $validatedData['password'],
|
||||||
]);
|
]);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return redirect()->back()->with('failed-status', 'Gagal mereset password pengguna.');
|
return redirect()->back()->with('failed-status', 'Gagal mereset password pengguna.');
|
||||||
@ -157,14 +166,15 @@ public function destroy($id)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function profile($type){
|
public function profile($type)
|
||||||
|
{
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'title' => 'Detail Akun',
|
'title' => 'Detail Akun',
|
||||||
'user' => Auth::user(),
|
'user' => Auth::user(),
|
||||||
'roles' => Role::all(),
|
'roles' => Role::all(),
|
||||||
'page' => 'profile',
|
'page' => 'profile',
|
||||||
'type' => $type
|
'type' => $type,
|
||||||
];
|
];
|
||||||
|
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
@ -175,6 +185,7 @@ public function profile($type){
|
|||||||
$data['loginActivities'] = LoginHistory::where('user_id', Auth::user()->id)
|
$data['loginActivities'] = LoginHistory::where('user_id', Auth::user()->id)
|
||||||
->orderByDesc('id')
|
->orderByDesc('id')
|
||||||
->simplePaginate(20);
|
->simplePaginate(20);
|
||||||
|
|
||||||
return view('dashboard.users.profiles.login-activity', $data);
|
return view('dashboard.users.profiles.login-activity', $data);
|
||||||
|
|
||||||
case 'company':
|
case 'company':
|
||||||
@ -191,7 +202,8 @@ public function profile($type){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function filter(Request $request){
|
public function filter(Request $request)
|
||||||
|
{
|
||||||
|
|
||||||
$filteredRequest = $request->except('_token');
|
$filteredRequest = $request->except('_token');
|
||||||
|
|
||||||
@ -202,7 +214,8 @@ public function filter(Request $request){
|
|||||||
return redirect()->route('dashboard.users.index', $filterField);
|
return redirect()->route('dashboard.users.index', $filterField);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function process($id, $type, $process){
|
public function process($id, $type, $process)
|
||||||
|
{
|
||||||
$user = User::with(['role', 'company.media.journalists'])->findOrFail(decrypt_id($id));
|
$user = User::with(['role', 'company.media.journalists'])->findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
@ -222,6 +235,7 @@ public function process($id, $type, $process){
|
|||||||
$data['loginActivities'] = LoginHistory::where('user_id', $user->id)
|
$data['loginActivities'] = LoginHistory::where('user_id', $user->id)
|
||||||
->orderByDesc('id')
|
->orderByDesc('id')
|
||||||
->simplePaginate(20);
|
->simplePaginate(20);
|
||||||
|
|
||||||
return view('dashboard.users.profiles.login-activity', $data);
|
return view('dashboard.users.profiles.login-activity', $data);
|
||||||
|
|
||||||
case 'company':
|
case 'company':
|
||||||
@ -239,14 +253,15 @@ public function process($id, $type, $process){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function statusAction(Request $request, $id, $action){
|
public function statusAction(Request $request, $id, $action)
|
||||||
|
{
|
||||||
$user = User::findOrFail(decrypt_id($id));
|
$user = User::findOrFail(decrypt_id($id));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if ($user->status === '0' && Auth::check() && is_role(['1'])) {
|
if ($user->status === '0' && Auth::check() && is_role(['1'])) {
|
||||||
if ($action == 'accept') {
|
if ($action == 'accept') {
|
||||||
$user->update([
|
$user->update([
|
||||||
'status' => '1'
|
'status' => '1',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
Mail::to($user->email)->send(new AccountVerification($user, 'accepted'));
|
Mail::to($user->email)->send(new AccountVerification($user, 'accepted'));
|
||||||
@ -261,11 +276,11 @@ public function statusAction(Request $request, $id, $action){
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
$user->update([
|
$user->update([
|
||||||
'status' => '3'
|
'status' => '3',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$user->company->update([
|
$user->company->update([
|
||||||
'rejection_reason' => $validatedData['rejection_reason']
|
'rejection_reason' => $validatedData['rejection_reason'],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
Mail::to($user->email)->send(new AccountVerification($user, 'rejected', strip_tags($validatedData['rejection_reason'])));
|
Mail::to($user->email)->send(new AccountVerification($user, 'rejected', strip_tags($validatedData['rejection_reason'])));
|
||||||
@ -280,7 +295,8 @@ public function statusAction(Request $request, $id, $action){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setting(){
|
public function setting()
|
||||||
|
{
|
||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
|
|
||||||
return view('dashboard.users.setting', [
|
return view('dashboard.users.setting', [
|
||||||
@ -289,7 +305,8 @@ public function setting(){
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function settingAction(AccountSettingRequest $request){
|
public function settingAction(AccountSettingRequest $request)
|
||||||
|
{
|
||||||
$validatedData = $request->validated();
|
$validatedData = $request->validated();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -305,23 +322,25 @@ public function settingAction(AccountSettingRequest $request){
|
|||||||
return redirect()->back()->with('success-status', 'Berhasil mengubah data akun.');
|
return redirect()->back()->with('success-status', 'Berhasil mengubah data akun.');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function changePassword(){
|
public function changePassword()
|
||||||
|
{
|
||||||
$user = User::with(['role'])->findOrFail(Auth::id());
|
$user = User::with(['role'])->findOrFail(Auth::id());
|
||||||
|
|
||||||
return view('dashboard.users.reset-password', [
|
return view('dashboard.users.reset-password', [
|
||||||
'title' => 'Ubah Password',
|
'title' => 'Ubah Password',
|
||||||
'page' => 'change',
|
'page' => 'change',
|
||||||
'user' => $user
|
'user' => $user,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function changePasswordAction(ChangePasswordRequest $request){
|
public function changePasswordAction(ChangePasswordRequest $request)
|
||||||
|
{
|
||||||
$validatedData = $request->validated();
|
$validatedData = $request->validated();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$user = User::findOrFail(Auth::id());
|
$user = User::findOrFail(Auth::id());
|
||||||
$user->update([
|
$user->update([
|
||||||
'password' => $validatedData['password']
|
'password' => $validatedData['password'],
|
||||||
]);
|
]);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return redirect()->back()->with('failed-status', 'Gagal mengubah password.');
|
return redirect()->back()->with('failed-status', 'Gagal mengubah password.');
|
||||||
@ -329,5 +348,4 @@ public function changePasswordAction(ChangePasswordRequest $request){
|
|||||||
|
|
||||||
return redirect()->route('dashboard.users.setting')->with('success-status', 'Berhasil mengubah password.');
|
return redirect()->route('dashboard.users.setting')->with('success-status', 'Berhasil mengubah password.');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,7 +22,8 @@ class HomepageController extends Controller
|
|||||||
|
|
||||||
protected $totalVisitor;
|
protected $totalVisitor;
|
||||||
|
|
||||||
public function __construct(){
|
public function __construct()
|
||||||
|
{
|
||||||
$today = Carbon::today();
|
$today = Carbon::today();
|
||||||
$yesterday = Carbon::yesterday();
|
$yesterday = Carbon::yesterday();
|
||||||
$thisMonth = Carbon::now()->startOfMonth();
|
$thisMonth = Carbon::now()->startOfMonth();
|
||||||
@ -53,7 +54,8 @@ public function __construct(){
|
|||||||
View::share('totalVisitor', $this->totalVisitor);
|
View::share('totalVisitor', $this->totalVisitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function landing(){
|
public function landing()
|
||||||
|
{
|
||||||
$data = [
|
$data = [
|
||||||
'title' => 'Beranda',
|
'title' => 'Beranda',
|
||||||
'page' => 'landing',
|
'page' => 'landing',
|
||||||
@ -70,14 +72,15 @@ public function landing(){
|
|||||||
return view('homepage.index', $data);
|
return view('homepage.index', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function search(Request $request){
|
public function search(Request $request)
|
||||||
|
{
|
||||||
|
|
||||||
$request->validate([
|
$request->validate([
|
||||||
'search' => 'nullable|string|max:255|regex:/^[a-zA-Z0-9\s]+$/'
|
'search' => 'nullable|string|max:255|regex:/^[a-zA-Z0-9\s]+$/',
|
||||||
], [
|
], [
|
||||||
'search.string' => 'Pencarian harus berupa teks.',
|
'search.string' => 'Pencarian harus berupa teks.',
|
||||||
'search.max' => 'Pencarian tidak boleh lebih dari 255 karakter.',
|
'search.max' => 'Pencarian tidak boleh lebih dari 255 karakter.',
|
||||||
'search.regex' => 'Pencarian hanya boleh mengandung huruf, angka, dan spasi.'
|
'search.regex' => 'Pencarian hanya boleh mengandung huruf, angka, dan spasi.',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$search = trim($request->input('search'));
|
$search = trim($request->input('search'));
|
||||||
@ -92,13 +95,14 @@ public function search(Request $request){
|
|||||||
->latest()
|
->latest()
|
||||||
->simplePaginate(12)
|
->simplePaginate(12)
|
||||||
->appends(['search' => $search]),
|
->appends(['search' => $search]),
|
||||||
'search' => $search
|
'search' => $search,
|
||||||
];
|
];
|
||||||
|
|
||||||
return view('homepage.search', $data);
|
return view('homepage.search', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function news(Request $request){
|
public function news(Request $request)
|
||||||
|
{
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'title' => 'Berita',
|
'title' => 'Berita',
|
||||||
@ -119,7 +123,8 @@ public function news(Request $request){
|
|||||||
return view('homepage.news.index', $data);
|
return view('homepage.news.index', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function readNews($slug){
|
public function readNews($slug)
|
||||||
|
{
|
||||||
$news = News::where('slug', $slug)->first();
|
$news = News::where('slug', $slug)->first();
|
||||||
$news->increment('views', 1);
|
$news->increment('views', 1);
|
||||||
|
|
||||||
@ -128,14 +133,15 @@ public function readNews($slug){
|
|||||||
'page' => 'news',
|
'page' => 'news',
|
||||||
'news' => $news,
|
'news' => $news,
|
||||||
'popularNews' => News::where('category', '0')->orderBy('views', 'desc')->take(5)->get(),
|
'popularNews' => News::where('category', '0')->orderBy('views', 'desc')->take(5)->get(),
|
||||||
'otherNews' => News::where('category', '0')->orderByDesc('id')->where('id', '!=', $news->id)->take(3)->get()
|
'otherNews' => News::where('category', '0')->orderByDesc('id')->where('id', '!=', $news->id)->take(3)->get(),
|
||||||
];
|
];
|
||||||
|
|
||||||
return view('homepage.news.read', $data);
|
return view('homepage.news.read', $data);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function announcement(Request $request){
|
public function announcement(Request $request)
|
||||||
|
{
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'title' => 'Pengumuman',
|
'title' => 'Pengumuman',
|
||||||
@ -156,7 +162,8 @@ public function announcement(Request $request){
|
|||||||
return view('homepage.announcements.index', $data);
|
return view('homepage.announcements.index', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function readAnnouncement($slug){
|
public function readAnnouncement($slug)
|
||||||
|
{
|
||||||
$announcement = News::where('slug', $slug)->first();
|
$announcement = News::where('slug', $slug)->first();
|
||||||
$announcement->increment('views', 1);
|
$announcement->increment('views', 1);
|
||||||
|
|
||||||
@ -164,45 +171,49 @@ public function readAnnouncement($slug){
|
|||||||
'title' => 'Pengumuman',
|
'title' => 'Pengumuman',
|
||||||
'page' => 'announcements',
|
'page' => 'announcements',
|
||||||
'announcement' => $announcement,
|
'announcement' => $announcement,
|
||||||
'otherAnnouncements' => News::where('category', '1')->orderByDesc('id')->where('id', '!=', $announcement->id)->take(4)->get()
|
'otherAnnouncements' => News::where('category', '1')->orderByDesc('id')->where('id', '!=', $announcement->id)->take(4)->get(),
|
||||||
];
|
];
|
||||||
|
|
||||||
return view('homepage.announcements.read', $data);
|
return view('homepage.announcements.read', $data);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function aboutUs(){
|
public function aboutUs()
|
||||||
|
{
|
||||||
$data = [
|
$data = [
|
||||||
'title' => 'Tentang Kami',
|
'title' => 'Tentang Kami',
|
||||||
'page' => 'about_us'
|
'page' => 'about_us',
|
||||||
];
|
];
|
||||||
|
|
||||||
return view('homepage.about-us.index', $data);
|
return view('homepage.about-us.index', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function contact(){
|
public function contact()
|
||||||
|
{
|
||||||
$data = [
|
$data = [
|
||||||
'title' => 'Kontak',
|
'title' => 'Kontak',
|
||||||
'page' => 'contacts'
|
'page' => 'contacts',
|
||||||
];
|
];
|
||||||
|
|
||||||
return view('homepage.contacts.index', $data);
|
return view('homepage.contacts.index', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function receiveMessage(ReceiveMessageContactRequest $request){
|
public function receiveMessage(ReceiveMessageContactRequest $request)
|
||||||
|
{
|
||||||
$validatedData = $request->validated();
|
$validatedData = $request->validated();
|
||||||
$validatedData['ip_address'] = $request->ip();
|
$validatedData['ip_address'] = $request->ip();
|
||||||
|
|
||||||
$createdMessage = Contact::create($validatedData);
|
$createdMessage = Contact::create($validatedData);
|
||||||
|
|
||||||
if ($createdMessage) {
|
if ($createdMessage) {
|
||||||
return "Berhasil mengirim pesan";
|
return 'Berhasil mengirim pesan';
|
||||||
} else {
|
} else {
|
||||||
return "Gagal mengirim pesan";
|
return 'Gagal mengirim pesan';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function customError($code){
|
public function customError($code)
|
||||||
|
{
|
||||||
abort($code);
|
abort($code);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Http\Middleware;
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
use App\Models\Announcement;
|
|
||||||
use App\Models\Media;
|
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Closure;
|
use Closure;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|||||||
@ -5,7 +5,6 @@
|
|||||||
use App\Models\Visitor;
|
use App\Models\Visitor;
|
||||||
use Closure;
|
use Closure;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\DB;
|
|
||||||
use Illuminate\Support\Facades\RateLimiter;
|
use Illuminate\Support\Facades\RateLimiter;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Http\Requests;
|
namespace App\Http\Requests;
|
||||||
|
|
||||||
use Dotenv\Util\Str;
|
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
|
|||||||
@ -32,7 +32,7 @@ public function rules(): array
|
|||||||
'my_password' => ['required', Password::min(8)
|
'my_password' => ['required', Password::min(8)
|
||||||
->mixedCase()
|
->mixedCase()
|
||||||
->numbers()
|
->numbers()
|
||||||
->symbols(), new MatchCurrentPasswordRule()],
|
->symbols(), new MatchCurrentPasswordRule],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Illuminate\Support\Str;
|
|
||||||
|
|
||||||
class ClassificationRequest extends FormRequest
|
class ClassificationRequest extends FormRequest
|
||||||
{
|
{
|
||||||
|
|||||||
@ -73,6 +73,4 @@ public function messages()
|
|||||||
'description.nullable' => 'Deskripsi bersifat opsional.',
|
'description.nullable' => 'Deskripsi bersifat opsional.',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -61,5 +61,4 @@ public function messages(): array
|
|||||||
'other_document.max' => 'Ukuran dokumen lainnya tidak boleh lebih dari 2MB.',
|
'other_document.max' => 'Ukuran dokumen lainnya tidak boleh lebih dari 2MB.',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -75,5 +75,4 @@ public function messages(): array
|
|||||||
'description.required' => 'Deskripsi kerja sama wajib diisi.',
|
'description.required' => 'Deskripsi kerja sama wajib diisi.',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,6 +35,7 @@ public function rules(): array
|
|||||||
'enhancer_id' => ['required'],
|
'enhancer_id' => ['required'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function prepareForValidation()
|
protected function prepareForValidation()
|
||||||
{
|
{
|
||||||
$this->merge([
|
$this->merge([
|
||||||
@ -67,5 +68,4 @@ public function messages()
|
|||||||
'government_agencies.*.exists' => 'Agensi pemerintah yang dipilih tidak valid.',
|
'government_agencies.*.exists' => 'Agensi pemerintah yang dipilih tidak valid.',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,7 +26,7 @@ public function rules(): array
|
|||||||
'journalist_ids' => ['required', 'array'],
|
'journalist_ids' => ['required', 'array'],
|
||||||
'journalist_ids.*' => ['required', 'exists:journalists,id'],
|
'journalist_ids.*' => ['required', 'exists:journalists,id'],
|
||||||
'e_catalog' => ['nullable'],
|
'e_catalog' => ['nullable'],
|
||||||
'description' => ['nullable']
|
'description' => ['nullable'],
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($this->isMethod('post')) {
|
if ($this->isMethod('post')) {
|
||||||
@ -53,7 +53,4 @@ public function messages(): array
|
|||||||
'description.nullable' => 'Deskripsi boleh kosong.',
|
'description.nullable' => 'Deskripsi boleh kosong.',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -92,6 +92,4 @@ public function messages()
|
|||||||
'image.max' => 'Ukuran gambar tidak boleh lebih dari 2MB.',
|
'image.max' => 'Ukuran gambar tidak boleh lebih dari 2MB.',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,7 +34,8 @@ public function rules(): array
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function prepareForValidation(){
|
public function prepareForValidation()
|
||||||
|
{
|
||||||
$this->merge([
|
$this->merge([
|
||||||
'enhancer_id' => Auth::check() ? Auth::id() : null,
|
'enhancer_id' => Auth::check() ? Auth::id() : null,
|
||||||
]);
|
]);
|
||||||
@ -66,5 +67,4 @@ public function messages(): array
|
|||||||
'task_description.required' => 'Deskripsi tugas harus diisi.',
|
'task_description.required' => 'Deskripsi tugas harus diisi.',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,6 @@
|
|||||||
namespace App\Http\Requests;
|
namespace App\Http\Requests;
|
||||||
|
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
use Illuminate\Support\Facades\Auth;
|
|
||||||
|
|
||||||
class ReceiveMessageContactRequest extends FormRequest
|
class ReceiveMessageContactRequest extends FormRequest
|
||||||
{
|
{
|
||||||
|
|||||||
@ -52,5 +52,4 @@ public function messages(): array
|
|||||||
'proof.max' => 'Ukuran gambar tidak boleh lebih dari 2MB.',
|
'proof.max' => 'Ukuran gambar tidak boleh lebih dari 2MB.',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,7 +32,7 @@ public function rules(): array
|
|||||||
'my_password' => ['required', Password::min(8)
|
'my_password' => ['required', Password::min(8)
|
||||||
->mixedCase()
|
->mixedCase()
|
||||||
->numbers()
|
->numbers()
|
||||||
->symbols(), new MatchCurrentPasswordRule()],
|
->symbols(), new MatchCurrentPasswordRule],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,5 +54,4 @@ public function messages()
|
|||||||
'my_password.symbols' => 'Password Anda harus mengandung simbol.',
|
'my_password.symbols' => 'Password Anda harus mengandung simbol.',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -60,5 +60,4 @@ protected function prepareForValidation()
|
|||||||
'contact_telegram' => filled($this->contact_telegram) ? $this->contact_telegram : null,
|
'contact_telegram' => filled($this->contact_telegram) ? $this->contact_telegram : null,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -51,5 +51,4 @@ protected function prepareForValidation()
|
|||||||
'enhancer_id' => Auth::check() ? Auth::id() : null,
|
'enhancer_id' => Auth::check() ? Auth::id() : null,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Http\Requests;
|
namespace App\Http\Requests;
|
||||||
|
|
||||||
use App\Rules\MatchCurrentPasswordRule;
|
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Illuminate\Validation\Rules\Password;
|
use Illuminate\Validation\Rules\Password;
|
||||||
@ -47,8 +46,8 @@ public function rules(): array
|
|||||||
return $rules;
|
return $rules;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function prepareForValidation()
|
||||||
public function prepareForValidation(){
|
{
|
||||||
if (! filled(trim($this->password))) {
|
if (! filled(trim($this->password))) {
|
||||||
$this->request->remove('password');
|
$this->request->remove('password');
|
||||||
}
|
}
|
||||||
@ -78,5 +77,4 @@ public function messages()
|
|||||||
'password.symbols' => 'Password harus mengandung simbol.',
|
'password.symbols' => 'Password harus mengandung simbol.',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,8 +4,6 @@
|
|||||||
|
|
||||||
use App\Models\LoginHistory;
|
use App\Models\LoginHistory;
|
||||||
use Illuminate\Auth\Events\Login;
|
use Illuminate\Auth\Events\Login;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
||||||
use Illuminate\Queue\InteractsWithQueue;
|
|
||||||
|
|
||||||
class LogUserLogin
|
class LogUserLogin
|
||||||
{
|
{
|
||||||
|
|||||||
@ -3,7 +3,6 @@
|
|||||||
namespace App\Mail;
|
namespace App\Mail;
|
||||||
|
|
||||||
use Illuminate\Bus\Queueable;
|
use Illuminate\Bus\Queueable;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
||||||
use Illuminate\Mail\Mailable;
|
use Illuminate\Mail\Mailable;
|
||||||
use Illuminate\Mail\Mailables\Content;
|
use Illuminate\Mail\Mailables\Content;
|
||||||
use Illuminate\Mail\Mailables\Envelope;
|
use Illuminate\Mail\Mailables\Envelope;
|
||||||
@ -17,7 +16,9 @@ class AccountVerification extends Mailable
|
|||||||
* Create a new message instance.
|
* Create a new message instance.
|
||||||
*/
|
*/
|
||||||
public $status;
|
public $status;
|
||||||
|
|
||||||
public $reason;
|
public $reason;
|
||||||
|
|
||||||
public $user;
|
public $user;
|
||||||
|
|
||||||
public function __construct($user, $status, $rejectionReason = null)
|
public function __construct($user, $status, $rejectionReason = null)
|
||||||
|
|||||||
@ -4,12 +4,13 @@
|
|||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use Spatie\Activitylog\Traits\LogsActivity;
|
|
||||||
use Spatie\Activitylog\LogOptions;
|
use Spatie\Activitylog\LogOptions;
|
||||||
|
use Spatie\Activitylog\Traits\LogsActivity;
|
||||||
|
|
||||||
class AiringProofTheme extends Model
|
class AiringProofTheme extends Model
|
||||||
{
|
{
|
||||||
use SoftDeletes, LogsActivity;
|
use LogsActivity, SoftDeletes;
|
||||||
|
|
||||||
protected $table = 'airing_proof_themes';
|
protected $table = 'airing_proof_themes';
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
@ -17,10 +18,11 @@ class AiringProofTheme extends Model
|
|||||||
'slug',
|
'slug',
|
||||||
'year',
|
'year',
|
||||||
'description',
|
'description',
|
||||||
'enhancer_id'
|
'enhancer_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function enhancer(){
|
public function enhancer()
|
||||||
|
{
|
||||||
return $this->belongsTo(User::class, 'enhancer_id', 'id');
|
return $this->belongsTo(User::class, 'enhancer_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,12 +3,13 @@
|
|||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Spatie\Activitylog\Traits\LogsActivity;
|
|
||||||
use Spatie\Activitylog\LogOptions;
|
use Spatie\Activitylog\LogOptions;
|
||||||
|
use Spatie\Activitylog\Traits\LogsActivity;
|
||||||
|
|
||||||
class Announcement extends Model
|
class Announcement extends Model
|
||||||
{
|
{
|
||||||
use LogsActivity;
|
use LogsActivity;
|
||||||
|
|
||||||
protected $table = 'announcements';
|
protected $table = 'announcements';
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
@ -16,10 +17,11 @@ class Announcement extends Model
|
|||||||
'content',
|
'content',
|
||||||
'link',
|
'link',
|
||||||
'attachment',
|
'attachment',
|
||||||
'enhancer_id'
|
'enhancer_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function enhancer(){
|
public function enhancer()
|
||||||
|
{
|
||||||
return $this->belongsTo(User::class, 'enhancer_id', 'id');
|
return $this->belongsTo(User::class, 'enhancer_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
use Illuminate\Database\Eloquent\Relations\Pivot;
|
use Illuminate\Database\Eloquent\Relations\Pivot;
|
||||||
|
|
||||||
class AnnouncementUser extends Pivot
|
class AnnouncementUser extends Pivot
|
||||||
@ -13,14 +12,16 @@ class AnnouncementUser extends Pivot
|
|||||||
'announcement_id',
|
'announcement_id',
|
||||||
'user_id',
|
'user_id',
|
||||||
'status',
|
'status',
|
||||||
'category'
|
'category',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function announcement(){
|
public function announcement()
|
||||||
|
{
|
||||||
return $this->belongsTo(Announcement::class, 'announcement_id', 'id');
|
return $this->belongsTo(Announcement::class, 'announcement_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function user(){
|
public function user()
|
||||||
|
{
|
||||||
return $this->belongsTo(User::class, 'user_id', 'id');
|
return $this->belongsTo(User::class, 'user_id', 'id');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,30 +4,34 @@
|
|||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use Spatie\Activitylog\Traits\LogsActivity;
|
|
||||||
use Spatie\Activitylog\LogOptions;
|
use Spatie\Activitylog\LogOptions;
|
||||||
|
use Spatie\Activitylog\Traits\LogsActivity;
|
||||||
|
|
||||||
class Classification extends Model
|
class Classification extends Model
|
||||||
{
|
{
|
||||||
use SoftDeletes, LogsActivity;
|
use LogsActivity, SoftDeletes;
|
||||||
|
|
||||||
protected $table = 'classifications';
|
protected $table = 'classifications';
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'name',
|
'name',
|
||||||
'status',
|
'status',
|
||||||
'description',
|
'description',
|
||||||
'enhancer_id'
|
'enhancer_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function subClassifications(){
|
public function subClassifications()
|
||||||
|
{
|
||||||
return $this->hasMany(SubClassification::class, 'classification_id', 'id');
|
return $this->hasMany(SubClassification::class, 'classification_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function issues(){
|
public function issues()
|
||||||
|
{
|
||||||
return $this->hasMany(IssueManagement::class, 'classification_id', 'id');
|
return $this->hasMany(IssueManagement::class, 'classification_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function enhancer(){
|
public function enhancer()
|
||||||
|
{
|
||||||
return $this->belongsTo(User::class, 'enhancer_id', 'id');
|
return $this->belongsTo(User::class, 'enhancer_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,5 +59,4 @@ public function getDescriptionForEvent(string $eventName): string
|
|||||||
|
|
||||||
return "Klasifikasi '{$this->name}' telah {$eventName}";
|
return "Klasifikasi '{$this->name}' telah {$eventName}";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,7 @@
|
|||||||
class Company extends Model
|
class Company extends Model
|
||||||
{
|
{
|
||||||
use SoftDeletes;
|
use SoftDeletes;
|
||||||
|
|
||||||
protected $table = 'companies';
|
protected $table = 'companies';
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
@ -39,14 +40,16 @@ class Company extends Model
|
|||||||
'edit_rejection_reason',
|
'edit_rejection_reason',
|
||||||
'validated_at',
|
'validated_at',
|
||||||
'rejection_reason',
|
'rejection_reason',
|
||||||
'user_id'
|
'user_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function user(){
|
public function user()
|
||||||
|
{
|
||||||
return $this->belongsTo(User::class, 'user_id', 'id')->withTrashed();
|
return $this->belongsTo(User::class, 'user_id', 'id')->withTrashed();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function media(){
|
public function media()
|
||||||
|
{
|
||||||
return $this->hasOne(Media::class, 'company_id', 'id')->withTrashed();
|
return $this->hasOne(Media::class, 'company_id', 'id')->withTrashed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,12 +4,13 @@
|
|||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use Spatie\Activitylog\Traits\LogsActivity;
|
|
||||||
use Spatie\Activitylog\LogOptions;
|
use Spatie\Activitylog\LogOptions;
|
||||||
|
use Spatie\Activitylog\Traits\LogsActivity;
|
||||||
|
|
||||||
class ContentRecap extends Model
|
class ContentRecap extends Model
|
||||||
{
|
{
|
||||||
use SoftDeletes, LogsActivity;
|
use LogsActivity, SoftDeletes;
|
||||||
|
|
||||||
protected $table = 'content_recaps';
|
protected $table = 'content_recaps';
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
@ -30,7 +31,8 @@ public function enhancer()
|
|||||||
return $this->belongsTo(User::class, 'enhancer_id', 'id');
|
return $this->belongsTo(User::class, 'enhancer_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function classification(){
|
public function classification()
|
||||||
|
{
|
||||||
return $this->belongsTo(ContentRecapClassification::class, 'classification_id', 'id');
|
return $this->belongsTo(ContentRecapClassification::class, 'classification_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4,12 +4,13 @@
|
|||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use Spatie\Activitylog\Traits\LogsActivity;
|
|
||||||
use Spatie\Activitylog\LogOptions;
|
use Spatie\Activitylog\LogOptions;
|
||||||
|
use Spatie\Activitylog\Traits\LogsActivity;
|
||||||
|
|
||||||
class ContentRecapClassification extends Model
|
class ContentRecapClassification extends Model
|
||||||
{
|
{
|
||||||
use SoftDeletes, LogsActivity;
|
use LogsActivity, SoftDeletes;
|
||||||
|
|
||||||
protected $table = 'content_recap_classifications';
|
protected $table = 'content_recap_classifications';
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
@ -17,14 +18,16 @@ class ContentRecapClassification extends Model
|
|||||||
'slug',
|
'slug',
|
||||||
'year',
|
'year',
|
||||||
'description',
|
'description',
|
||||||
'enhancer_id'
|
'enhancer_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function contentRecaps(){
|
public function contentRecaps()
|
||||||
|
{
|
||||||
return $this->hasMany(ContentRecap::class, 'classification_id', 'id');
|
return $this->hasMany(ContentRecap::class, 'classification_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function enhancer(){
|
public function enhancer()
|
||||||
|
{
|
||||||
return $this->belongsTo(User::class, 'enhancer_id', 'id');
|
return $this->belongsTo(User::class, 'enhancer_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4,12 +4,12 @@
|
|||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use Spatie\Activitylog\Traits\LogsActivity;
|
|
||||||
use Spatie\Activitylog\LogOptions;
|
use Spatie\Activitylog\LogOptions;
|
||||||
|
use Spatie\Activitylog\Traits\LogsActivity;
|
||||||
|
|
||||||
class Cooperation extends Model
|
class Cooperation extends Model
|
||||||
{
|
{
|
||||||
use SoftDeletes, LogsActivity;
|
use LogsActivity, SoftDeletes;
|
||||||
|
|
||||||
protected $table = 'cooperations';
|
protected $table = 'cooperations';
|
||||||
|
|
||||||
@ -31,11 +31,13 @@ public function media()
|
|||||||
->withTimestamps();
|
->withTimestamps();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function proposals(){
|
public function proposals()
|
||||||
|
{
|
||||||
return $this->hasMany(CooperationProposal::class, 'cooperation_id', 'id');
|
return $this->hasMany(CooperationProposal::class, 'cooperation_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function mediaOrder(){
|
public function mediaOrder()
|
||||||
|
{
|
||||||
return $this->hasOne(Order::class, 'cooperation_id', 'id');
|
return $this->hasOne(Order::class, 'cooperation_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,12 +3,13 @@
|
|||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Spatie\Activitylog\Traits\LogsActivity;
|
|
||||||
use Spatie\Activitylog\LogOptions;
|
use Spatie\Activitylog\LogOptions;
|
||||||
|
use Spatie\Activitylog\Traits\LogsActivity;
|
||||||
|
|
||||||
class CooperationCompletion extends Model
|
class CooperationCompletion extends Model
|
||||||
{
|
{
|
||||||
use LogsActivity;
|
use LogsActivity;
|
||||||
|
|
||||||
protected $table = 'cooperation_completions';
|
protected $table = 'cooperation_completions';
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
@ -24,11 +25,13 @@ class CooperationCompletion extends Model
|
|||||||
'order_id',
|
'order_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function order(){
|
public function order()
|
||||||
|
{
|
||||||
return $this->belongsTo(Order::class, 'order_id', 'id');
|
return $this->belongsTo(Order::class, 'order_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function media(){
|
public function media()
|
||||||
|
{
|
||||||
return $this->belongsTo(Media::class, 'media_id', 'id');
|
return $this->belongsTo(Media::class, 'media_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,9 +3,8 @@
|
|||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
||||||
use Spatie\Activitylog\Traits\LogsActivity;
|
|
||||||
use Spatie\Activitylog\LogOptions;
|
use Spatie\Activitylog\LogOptions;
|
||||||
|
use Spatie\Activitylog\Traits\LogsActivity;
|
||||||
|
|
||||||
class CooperationProposal extends Model
|
class CooperationProposal extends Model
|
||||||
{
|
{
|
||||||
@ -23,11 +22,13 @@ class CooperationProposal extends Model
|
|||||||
'media_id',
|
'media_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function media(){
|
public function media()
|
||||||
|
{
|
||||||
return $this->belongsTo(Media::class, 'media_id', 'id');
|
return $this->belongsTo(Media::class, 'media_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function cooperation(){
|
public function cooperation()
|
||||||
|
{
|
||||||
return $this->belongsTo(Cooperation::class, 'cooperation_id', 'id');
|
return $this->belongsTo(Cooperation::class, 'cooperation_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4,12 +4,12 @@
|
|||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use Spatie\Activitylog\Traits\LogsActivity;
|
|
||||||
use Spatie\Activitylog\LogOptions;
|
use Spatie\Activitylog\LogOptions;
|
||||||
|
use Spatie\Activitylog\Traits\LogsActivity;
|
||||||
|
|
||||||
class GovernmentAgency extends Model
|
class GovernmentAgency extends Model
|
||||||
{
|
{
|
||||||
use SoftDeletes, LogsActivity;
|
use LogsActivity, SoftDeletes;
|
||||||
|
|
||||||
protected $table = 'government_agencies';
|
protected $table = 'government_agencies';
|
||||||
|
|
||||||
@ -28,7 +28,8 @@ public function issues()
|
|||||||
->withTimestamps();
|
->withTimestamps();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function enhancer(){
|
public function enhancer()
|
||||||
|
{
|
||||||
return $this->belongsTo(User::class, 'enhancer_id', 'id');
|
return $this->belongsTo(User::class, 'enhancer_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,14 +3,13 @@
|
|||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Model\Pivot;
|
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use Spatie\Activitylog\Traits\LogsActivity;
|
|
||||||
use Spatie\Activitylog\LogOptions;
|
use Spatie\Activitylog\LogOptions;
|
||||||
|
use Spatie\Activitylog\Traits\LogsActivity;
|
||||||
|
|
||||||
class IssueManagement extends Model
|
class IssueManagement extends Model
|
||||||
{
|
{
|
||||||
use SoftDeletes, LogsActivity;
|
use LogsActivity, SoftDeletes;
|
||||||
|
|
||||||
protected $table = 'issue_managements';
|
protected $table = 'issue_managements';
|
||||||
|
|
||||||
@ -26,20 +25,28 @@ class IssueManagement extends Model
|
|||||||
'enhancer_id',
|
'enhancer_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function location(){
|
public function location()
|
||||||
|
{
|
||||||
return $this->belongsTo(Location::class, 'location_id', 'id');
|
return $this->belongsTo(Location::class, 'location_id', 'id');
|
||||||
}
|
}
|
||||||
public function subLocation(){
|
|
||||||
|
public function subLocation()
|
||||||
|
{
|
||||||
return $this->belongsTo(SubLocation::class, 'sub_location_id', 'id');
|
return $this->belongsTo(SubLocation::class, 'sub_location_id', 'id');
|
||||||
}
|
}
|
||||||
public function classification(){
|
|
||||||
|
public function classification()
|
||||||
|
{
|
||||||
return $this->belongsTo(Classification::class, 'classification_id', 'id');
|
return $this->belongsTo(Classification::class, 'classification_id', 'id');
|
||||||
}
|
}
|
||||||
public function subClassification(){
|
|
||||||
|
public function subClassification()
|
||||||
|
{
|
||||||
return $this->belongsTo(SubClassification::class, 'sub_classification_id', 'id');
|
return $this->belongsTo(SubClassification::class, 'sub_classification_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function mediaMonitoring(){
|
public function mediaMonitoring()
|
||||||
|
{
|
||||||
return $this->belongsTo(MediaMonitoring::class, 'media_monitoring_id', 'id');
|
return $this->belongsTo(MediaMonitoring::class, 'media_monitoring_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,7 +57,8 @@ public function governmentAgencies()
|
|||||||
->withTimestamps();
|
->withTimestamps();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function enhancer(){
|
public function enhancer()
|
||||||
|
{
|
||||||
return $this->belongsTo(User::class, 'enhancer_id', 'id');
|
return $this->belongsTo(User::class, 'enhancer_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,5 +96,4 @@ public function getDescriptionForEvent(string $eventName): string
|
|||||||
|
|
||||||
return "Manajemen Isu telah {$eventName}";
|
return "Manajemen Isu telah {$eventName}";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
use Illuminate\Database\Eloquent\Relations\Pivot;
|
use Illuminate\Database\Eloquent\Relations\Pivot;
|
||||||
|
|
||||||
class IssueManagementGovernmentAgency extends Pivot
|
class IssueManagementGovernmentAgency extends Pivot
|
||||||
@ -14,12 +13,13 @@ class IssueManagementGovernmentAgency extends Pivot
|
|||||||
'government_agency_id',
|
'government_agency_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function issueManagement(){
|
public function issueManagement()
|
||||||
|
{
|
||||||
return $this->belongsTo(IssueManagement::class, 'issue_management_id', 'id');
|
return $this->belongsTo(IssueManagement::class, 'issue_management_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function GovernmentAgency(){
|
public function GovernmentAgency()
|
||||||
|
{
|
||||||
return $this->belongsTo(GovernmentAgency::class, 'government_agency_id', 'id');
|
return $this->belongsTo(GovernmentAgency::class, 'government_agency_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,10 +24,11 @@ class Journalist extends Model
|
|||||||
'edit_description',
|
'edit_description',
|
||||||
'edit_status',
|
'edit_status',
|
||||||
'edit_rejection_reason',
|
'edit_rejection_reason',
|
||||||
'media_id'
|
'media_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function media(){
|
public function media()
|
||||||
|
{
|
||||||
return $this->belongsTo(Media::class, 'media_id', 'id')->withTrashed();
|
return $this->belongsTo(Media::class, 'media_id', 'id')->withTrashed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
use Illuminate\Database\Eloquent\Relations\Pivot;
|
use Illuminate\Database\Eloquent\Relations\Pivot;
|
||||||
|
|
||||||
class JournalistCooperationProposal extends Pivot
|
class JournalistCooperationProposal extends Pivot
|
||||||
@ -14,11 +13,13 @@ class JournalistCooperationProposal extends Pivot
|
|||||||
'cooperation_proposal_id',
|
'cooperation_proposal_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function journalist(){
|
public function journalist()
|
||||||
|
{
|
||||||
return $this->belongsTo(Journalist::class, 'journalists_id', 'id');
|
return $this->belongsTo(Journalist::class, 'journalists_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function cooperationProposal(){
|
public function cooperationProposal()
|
||||||
|
{
|
||||||
return $this->belongsTo(CooperationProposal::class, 'cooperation_proposal_id', 'id');
|
return $this->belongsTo(CooperationProposal::class, 'cooperation_proposal_id', 'id');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,30 +3,34 @@
|
|||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Spatie\Activitylog\Traits\LogsActivity;
|
|
||||||
use Spatie\Activitylog\LogOptions;
|
use Spatie\Activitylog\LogOptions;
|
||||||
|
use Spatie\Activitylog\Traits\LogsActivity;
|
||||||
|
|
||||||
class Location extends Model
|
class Location extends Model
|
||||||
{
|
{
|
||||||
use LogsActivity;
|
use LogsActivity;
|
||||||
|
|
||||||
protected $table = 'locations';
|
protected $table = 'locations';
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'name',
|
'name',
|
||||||
'status',
|
'status',
|
||||||
'description',
|
'description',
|
||||||
'enhancer_id'
|
'enhancer_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function subLocations(){
|
public function subLocations()
|
||||||
|
{
|
||||||
return $this->hasMany(SubLocation::class, 'location_id', 'id');
|
return $this->hasMany(SubLocation::class, 'location_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function issues(){
|
public function issues()
|
||||||
|
{
|
||||||
return $this->hasMany(IssueManagement::class, 'location_id', 'id');
|
return $this->hasMany(IssueManagement::class, 'location_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function enhancer(){
|
public function enhancer()
|
||||||
|
{
|
||||||
return $this->belongsTo(User::class, 'enhancer_id', 'id');
|
return $this->belongsTo(User::class, 'enhancer_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -12,10 +12,11 @@ class LoginHistory extends Model
|
|||||||
'user_id',
|
'user_id',
|
||||||
'ip_address',
|
'ip_address',
|
||||||
'user_agent',
|
'user_agent',
|
||||||
'logged_in_at'
|
'logged_in_at',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function user(){
|
public function user()
|
||||||
|
{
|
||||||
return $this->belongsTo(User::class, 'user_id', 'id');
|
return $this->belongsTo(User::class, 'user_id', 'id');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,7 +24,7 @@ class Media extends Model
|
|||||||
'edit_description',
|
'edit_description',
|
||||||
'edit_status',
|
'edit_status',
|
||||||
'edit_rejection_reason',
|
'edit_rejection_reason',
|
||||||
'company_id'
|
'company_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function user()
|
public function user()
|
||||||
@ -39,12 +39,13 @@ public function user()
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function company()
|
||||||
public function company(){
|
{
|
||||||
return $this->belongsTo(Company::class, 'company_id', 'id')->withTrashed();
|
return $this->belongsTo(Company::class, 'company_id', 'id')->withTrashed();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function journalists(){
|
public function journalists()
|
||||||
|
{
|
||||||
return $this->hasMany(Journalist::class, 'media_id', 'id')->withTrashed();
|
return $this->hasMany(Journalist::class, 'media_id', 'id')->withTrashed();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,11 +65,13 @@ public function orders()
|
|||||||
->withTimestamps();
|
->withTimestamps();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function reports(){
|
public function reports()
|
||||||
|
{
|
||||||
return $this->hasMany(Report::class, 'media_id', 'id');
|
return $this->hasMany(Report::class, 'media_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function completions(){
|
public function completions()
|
||||||
|
{
|
||||||
return $this->hasMany(CooperationCompletion::class, 'order_id', 'id');
|
return $this->hasMany(CooperationCompletion::class, 'order_id', 'id');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
use Illuminate\Database\Eloquent\Relations\Pivot;
|
use Illuminate\Database\Eloquent\Relations\Pivot;
|
||||||
|
|
||||||
class MediaCooperation extends Pivot
|
class MediaCooperation extends Pivot
|
||||||
@ -13,14 +12,16 @@ class MediaCooperation extends Pivot
|
|||||||
'cooperation_id',
|
'cooperation_id',
|
||||||
'media_id',
|
'media_id',
|
||||||
'status',
|
'status',
|
||||||
'rejection_reason'
|
'rejection_reason',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function cooperation(){
|
public function cooperation()
|
||||||
|
{
|
||||||
return $this->belongsTo(Cooperation::class, 'cooperation_id', 'id');
|
return $this->belongsTo(Cooperation::class, 'cooperation_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function media(){
|
public function media()
|
||||||
|
{
|
||||||
return $this->belongsTo(Media::class, 'media_id', 'id');
|
return $this->belongsTo(Media::class, 'media_id', 'id');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,12 +4,12 @@
|
|||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use Spatie\Activitylog\Traits\LogsActivity;
|
|
||||||
use Spatie\Activitylog\LogOptions;
|
use Spatie\Activitylog\LogOptions;
|
||||||
|
use Spatie\Activitylog\Traits\LogsActivity;
|
||||||
|
|
||||||
class MediaMonitoring extends Model
|
class MediaMonitoring extends Model
|
||||||
{
|
{
|
||||||
use SoftDeletes, LogsActivity;
|
use LogsActivity, SoftDeletes;
|
||||||
|
|
||||||
protected $table = 'media_monitorings';
|
protected $table = 'media_monitorings';
|
||||||
|
|
||||||
@ -31,7 +31,8 @@ class MediaMonitoring extends Model
|
|||||||
'enhancer_id',
|
'enhancer_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function issue(){
|
public function issue()
|
||||||
|
{
|
||||||
return $this->hasOne(IssueManagement::class, 'media_monitoring_id', 'id');
|
return $this->hasOne(IssueManagement::class, 'media_monitoring_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,5 +81,4 @@ public function getDescriptionForEvent(string $eventName): string
|
|||||||
|
|
||||||
return "Monitoring Media '{$this->title}' telah {$eventName}";
|
return "Monitoring Media '{$this->title}' telah {$eventName}";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
use Illuminate\Database\Eloquent\Relations\Pivot;
|
use Illuminate\Database\Eloquent\Relations\Pivot;
|
||||||
|
|
||||||
class MediaOrder extends Pivot
|
class MediaOrder extends Pivot
|
||||||
@ -13,14 +12,16 @@ class MediaOrder extends Pivot
|
|||||||
'order_id',
|
'order_id',
|
||||||
'media_id',
|
'media_id',
|
||||||
'status',
|
'status',
|
||||||
'rejection_reason'
|
'rejection_reason',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function order(){
|
public function order()
|
||||||
|
{
|
||||||
return $this->belongsTo(Order::class, 'order_id', 'id');
|
return $this->belongsTo(Order::class, 'order_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function media(){
|
public function media()
|
||||||
|
{
|
||||||
return $this->belongsTo(Media::class, 'media_id', 'id');
|
return $this->belongsTo(Media::class, 'media_id', 'id');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,12 +4,13 @@
|
|||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use Spatie\Activitylog\Traits\LogsActivity;
|
|
||||||
use Spatie\Activitylog\LogOptions;
|
use Spatie\Activitylog\LogOptions;
|
||||||
|
use Spatie\Activitylog\Traits\LogsActivity;
|
||||||
|
|
||||||
class News extends Model
|
class News extends Model
|
||||||
{
|
{
|
||||||
use SoftDeletes, LogsActivity;
|
use LogsActivity, SoftDeletes;
|
||||||
|
|
||||||
protected $table = 'news';
|
protected $table = 'news';
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
@ -21,10 +22,11 @@ class News extends Model
|
|||||||
'tag',
|
'tag',
|
||||||
'category',
|
'category',
|
||||||
'views',
|
'views',
|
||||||
'author_id'
|
'author_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function author(){
|
public function author()
|
||||||
|
{
|
||||||
return $this->belongsTo(User::class, 'author_id', 'id');
|
return $this->belongsTo(User::class, 'author_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4,13 +4,12 @@
|
|||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use Spatie\Activitylog\Traits\LogsActivity;
|
|
||||||
use Spatie\Activitylog\LogOptions;
|
use Spatie\Activitylog\LogOptions;
|
||||||
|
use Spatie\Activitylog\Traits\LogsActivity;
|
||||||
|
|
||||||
class Order extends Model
|
class Order extends Model
|
||||||
{
|
{
|
||||||
use SoftDeletes, LogsActivity;
|
use LogsActivity, SoftDeletes;
|
||||||
|
|
||||||
protected $table = 'orders';
|
protected $table = 'orders';
|
||||||
|
|
||||||
@ -32,15 +31,18 @@ public function media()
|
|||||||
->withTimestamps();
|
->withTimestamps();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function cooperation(){
|
public function cooperation()
|
||||||
|
{
|
||||||
return $this->belongsTo(Cooperation::class, 'cooperation_id', 'id')->withTrashed();
|
return $this->belongsTo(Cooperation::class, 'cooperation_id', 'id')->withTrashed();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function reports(){
|
public function reports()
|
||||||
|
{
|
||||||
return $this->hasMany(Report::class, 'order_id', 'id');
|
return $this->hasMany(Report::class, 'order_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function completions(){
|
public function completions()
|
||||||
|
{
|
||||||
return $this->hasMany(CooperationCompletion::class, 'order_id', 'id');
|
return $this->hasMany(CooperationCompletion::class, 'order_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4,12 +4,12 @@
|
|||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use Spatie\Activitylog\Traits\LogsActivity;
|
|
||||||
use Spatie\Activitylog\LogOptions;
|
use Spatie\Activitylog\LogOptions;
|
||||||
|
use Spatie\Activitylog\Traits\LogsActivity;
|
||||||
|
|
||||||
class Report extends Model
|
class Report extends Model
|
||||||
{
|
{
|
||||||
use SoftDeletes, LogsActivity;
|
use LogsActivity, SoftDeletes;
|
||||||
|
|
||||||
protected $table = 'reports';
|
protected $table = 'reports';
|
||||||
|
|
||||||
@ -25,11 +25,13 @@ class Report extends Model
|
|||||||
'order_id',
|
'order_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function order(){
|
public function order()
|
||||||
|
{
|
||||||
return $this->belongsTo(Order::class, 'order_id', 'id');
|
return $this->belongsTo(Order::class, 'order_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function media(){
|
public function media()
|
||||||
|
{
|
||||||
return $this->belongsTo(Media::class, 'media_id', 'id');
|
return $this->belongsTo(Media::class, 'media_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,20 +3,22 @@
|
|||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Spatie\Activitylog\Traits\LogsActivity;
|
|
||||||
use Spatie\Activitylog\LogOptions;
|
use Spatie\Activitylog\LogOptions;
|
||||||
|
use Spatie\Activitylog\Traits\LogsActivity;
|
||||||
|
|
||||||
class Role extends Model
|
class Role extends Model
|
||||||
{
|
{
|
||||||
use LogsActivity;
|
use LogsActivity;
|
||||||
|
|
||||||
protected $table = 'user_roles';
|
protected $table = 'user_roles';
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'name',
|
'name',
|
||||||
'description'
|
'description',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function user(){
|
public function user()
|
||||||
|
{
|
||||||
return $this->hasMany(User::class, 'role_id', 'id');
|
return $this->hasMany(User::class, 'role_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,7 +27,7 @@ public function getActivitylogOptions(): LogOptions
|
|||||||
return LogOptions::defaults()
|
return LogOptions::defaults()
|
||||||
->logOnly([
|
->logOnly([
|
||||||
'name',
|
'name',
|
||||||
'description'
|
'description',
|
||||||
]) // kolom yang dicatat
|
]) // kolom yang dicatat
|
||||||
->useLogName('user_role') // nama log
|
->useLogName('user_role') // nama log
|
||||||
->logOnlyDirty(); // hanya log kalau ada perubahan
|
->logOnlyDirty(); // hanya log kalau ada perubahan
|
||||||
|
|||||||
@ -4,12 +4,12 @@
|
|||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use Spatie\Activitylog\Traits\LogsActivity;
|
|
||||||
use Spatie\Activitylog\LogOptions;
|
use Spatie\Activitylog\LogOptions;
|
||||||
|
use Spatie\Activitylog\Traits\LogsActivity;
|
||||||
|
|
||||||
class SubClassification extends Model
|
class SubClassification extends Model
|
||||||
{
|
{
|
||||||
use SoftDeletes, LogsActivity;
|
use LogsActivity, SoftDeletes;
|
||||||
|
|
||||||
protected $table = 'sub_classifications';
|
protected $table = 'sub_classifications';
|
||||||
|
|
||||||
@ -18,18 +18,21 @@ class SubClassification extends Model
|
|||||||
'status',
|
'status',
|
||||||
'description',
|
'description',
|
||||||
'classification_id',
|
'classification_id',
|
||||||
'enhancer_id'
|
'enhancer_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function classification(){
|
public function classification()
|
||||||
|
{
|
||||||
return $this->belongsTo(Classification::class, 'classification_id', 'id')->withTrashed();
|
return $this->belongsTo(Classification::class, 'classification_id', 'id')->withTrashed();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function issues(){
|
public function issues()
|
||||||
|
{
|
||||||
return $this->hasMany(IssueManagement::class, 'sub_classification_id', 'id');
|
return $this->hasMany(IssueManagement::class, 'sub_classification_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function enhancer(){
|
public function enhancer()
|
||||||
|
{
|
||||||
return $this->belongsTo(User::class, 'enhancer_id', 'id');
|
return $this->belongsTo(User::class, 'enhancer_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,8 +3,8 @@
|
|||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Spatie\Activitylog\Traits\LogsActivity;
|
|
||||||
use Spatie\Activitylog\LogOptions;
|
use Spatie\Activitylog\LogOptions;
|
||||||
|
use Spatie\Activitylog\Traits\LogsActivity;
|
||||||
|
|
||||||
class SubLocation extends Model
|
class SubLocation extends Model
|
||||||
{
|
{
|
||||||
@ -17,18 +17,21 @@ class SubLocation extends Model
|
|||||||
'status',
|
'status',
|
||||||
'description',
|
'description',
|
||||||
'location_id',
|
'location_id',
|
||||||
'enhancer_id'
|
'enhancer_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function location(){
|
public function location()
|
||||||
|
{
|
||||||
return $this->belongsTo(Location::class, 'location_id', 'id');
|
return $this->belongsTo(Location::class, 'location_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function issues(){
|
public function issues()
|
||||||
|
{
|
||||||
return $this->hasMany(IssueManagement::class, 'sub_location_id', 'id');
|
return $this->hasMany(IssueManagement::class, 'sub_location_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function enhancer(){
|
public function enhancer()
|
||||||
|
{
|
||||||
return $this->belongsTo(User::class, 'enhancer_id', 'id');
|
return $this->belongsTo(User::class, 'enhancer_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4,8 +4,6 @@
|
|||||||
|
|
||||||
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
||||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||||
use Illuminate\Notifications\Notifiable;
|
use Illuminate\Notifications\Notifiable;
|
||||||
@ -25,7 +23,7 @@ class User extends Authenticatable
|
|||||||
'email',
|
'email',
|
||||||
'password',
|
'password',
|
||||||
'status',
|
'status',
|
||||||
'role_id'
|
'role_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -59,11 +57,13 @@ public function announcements()
|
|||||||
->withTimestamps();
|
->withTimestamps();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function role(){
|
public function role()
|
||||||
|
{
|
||||||
return $this->belongsTo(Role::class, 'role_id', 'id');
|
return $this->belongsTo(Role::class, 'role_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function company(){
|
public function company()
|
||||||
|
{
|
||||||
return $this->hasOne(Company::class, 'user_id', 'id')->withTrashed();
|
return $this->hasOne(Company::class, 'user_id', 'id')->withTrashed();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,7 +79,8 @@ public function media()
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function loginHistories(){
|
public function loginHistories()
|
||||||
|
{
|
||||||
return $this->hasMany(LoginHistory::class, 'user_id', 'id');
|
return $this->hasMany(LoginHistory::class, 'user_id', 'id');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,7 +10,6 @@ class Visitor extends Model
|
|||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'date',
|
'date',
|
||||||
'visitors'
|
'visitors',
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,7 +4,6 @@
|
|||||||
use App\Http\Middleware\AuthenticatedMiddleware;
|
use App\Http\Middleware\AuthenticatedMiddleware;
|
||||||
use App\Http\Middleware\RoleMiddleware;
|
use App\Http\Middleware\RoleMiddleware;
|
||||||
use App\Http\Middleware\VisitorCounterMiddleware;
|
use App\Http\Middleware\VisitorCounterMiddleware;
|
||||||
use Illuminate\Auth\Middleware\Authenticate;
|
|
||||||
use Illuminate\Foundation\Application;
|
use Illuminate\Foundation\Application;
|
||||||
use Illuminate\Foundation\Configuration\Exceptions;
|
use Illuminate\Foundation\Configuration\Exceptions;
|
||||||
use Illuminate\Foundation\Configuration\Middleware;
|
use Illuminate\Foundation\Configuration\Middleware;
|
||||||
|
|||||||
@ -81,7 +81,6 @@
|
|||||||
]) : [],
|
]) : [],
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
||||||
'mariadb' => [
|
'mariadb' => [
|
||||||
'driver' => 'mariadb',
|
'driver' => 'mariadb',
|
||||||
'url' => env('DB_URL'),
|
'url' => env('DB_URL'),
|
||||||
|
|||||||
@ -15,124 +15,107 @@
|
|||||||
return [
|
return [
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* The site key
|
* The site key
|
||||||
* get site key @ www.google.com/recaptcha/admin
|
* get site key @ www.google.com/recaptcha/admin
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
'api_site_key' => env('RECAPTCHA_SITE_KEY', ''),
|
'api_site_key' => env('RECAPTCHA_SITE_KEY', ''),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* The secret key
|
* The secret key
|
||||||
* get secret key @ www.google.com/recaptcha/admin
|
* get secret key @ www.google.com/recaptcha/admin
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
'api_secret_key' => env('RECAPTCHA_SECRET_KEY', ''),
|
'api_secret_key' => env('RECAPTCHA_SECRET_KEY', ''),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* ReCATCHA version
|
* ReCATCHA version
|
||||||
* Supported: "v2", "invisible", "v3",
|
* Supported: "v2", "invisible", "v3",
|
||||||
*
|
*
|
||||||
* get more info @ https://developers.google.com/recaptcha/docs/versions
|
* get more info @ https://developers.google.com/recaptcha/docs/versions
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
'version' => 'v2',
|
'version' => 'v2',
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* The curl timout in seconds to validate a recaptcha token
|
* The curl timout in seconds to validate a recaptcha token
|
||||||
* @since v3.5.0
|
|
||||||
*
|
*
|
||||||
|
* @since v3.5.0
|
||||||
*/
|
*/
|
||||||
'curl_timeout' => 10,
|
'curl_timeout' => 10,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* IP addresses for which validation will be skipped
|
* IP addresses for which validation will be skipped
|
||||||
* IP/CIDR netmask eg. 127.0.0.0/24, also 127.0.0.1 is accepted and /32 assumed
|
* IP/CIDR netmask eg. 127.0.0.0/24, also 127.0.0.1 is accepted and /32 assumed
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
'skip_ip' => env('RECAPTCHA_SKIP_IP', []),
|
'skip_ip' => env('RECAPTCHA_SKIP_IP', []),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* Default route called to check the Google reCAPTCHA token
|
* Default route called to check the Google reCAPTCHA token
|
||||||
* @since v3.2.0
|
|
||||||
*
|
*
|
||||||
|
* @since v3.2.0
|
||||||
*/
|
*/
|
||||||
'default_validation_route' => 'biscolab-recaptcha/validate',
|
'default_validation_route' => 'biscolab-recaptcha/validate',
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* The name of the parameter used to send Google reCAPTCHA token to verify route
|
* The name of the parameter used to send Google reCAPTCHA token to verify route
|
||||||
* @since v3.2.0
|
|
||||||
*
|
*
|
||||||
|
* @since v3.2.0
|
||||||
*/
|
*/
|
||||||
'default_token_parameter_name' => 'token',
|
'default_token_parameter_name' => 'token',
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* The default Google reCAPTCHA language code
|
* The default Google reCAPTCHA language code
|
||||||
* It has no effect with v3
|
* It has no effect with v3
|
||||||
|
*
|
||||||
* @see https://developers.google.com/recaptcha/docs/language
|
* @see https://developers.google.com/recaptcha/docs/language
|
||||||
* @since v3.6.0
|
* @since v3.6.0
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
'default_language' => null,
|
'default_language' => null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* The default form ID. Only for "invisible" reCAPTCHA
|
* The default form ID. Only for "invisible" reCAPTCHA
|
||||||
* @since v4.0.0
|
|
||||||
*
|
*
|
||||||
|
* @since v4.0.0
|
||||||
*/
|
*/
|
||||||
'default_form_id' => 'biscolab-recaptcha-invisible-form',
|
'default_form_id' => 'biscolab-recaptcha-invisible-form',
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* Deferring the render can be achieved by specifying your onload callback function and adding parameters to the JavaScript resource.
|
* Deferring the render can be achieved by specifying your onload callback function and adding parameters to the JavaScript resource.
|
||||||
* It has no effect with v3 and invisible
|
* It has no effect with v3 and invisible
|
||||||
|
*
|
||||||
* @see https://developers.google.com/recaptcha/docs/display#explicit_render
|
* @see https://developers.google.com/recaptcha/docs/display#explicit_render
|
||||||
* @since v4.0.0
|
* @since v4.0.0
|
||||||
* Supported true, false
|
* Supported true, false
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
'explicit' => false,
|
'explicit' => false,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* Set API domain. You can use "www.recaptcha.net" in case "www.google.com" is not accessible.
|
* Set API domain. You can use "www.recaptcha.net" in case "www.google.com" is not accessible.
|
||||||
* (no check will be made on the entered value)
|
* (no check will be made on the entered value)
|
||||||
|
*
|
||||||
* @see https://developers.google.com/recaptcha/docs/faq#can-i-use-recaptcha-globally
|
* @see https://developers.google.com/recaptcha/docs/faq#can-i-use-recaptcha-globally
|
||||||
* @since v4.3.0
|
* @since v4.3.0
|
||||||
* Default 'www.google.com' (ReCaptchaBuilder::DEFAULT_RECAPTCHA_API_DOMAIN)
|
* Default 'www.google.com' (ReCaptchaBuilder::DEFAULT_RECAPTCHA_API_DOMAIN)
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
'api_domain' => 'www.google.com',
|
'api_domain' => 'www.google.com',
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* Set `true` when the error message must be null
|
* Set `true` when the error message must be null
|
||||||
|
*
|
||||||
* @since v5.1.0
|
* @since v5.1.0
|
||||||
* Default false
|
* Default false
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
'empty_message' => false,
|
'empty_message' => false,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* Set either the error message or the errom message translation key
|
* Set either the error message or the errom message translation key
|
||||||
|
*
|
||||||
* @since v5.1.0
|
* @since v5.1.0
|
||||||
* Default 'validation.recaptcha'
|
* Default 'validation.recaptcha'
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
'error_message_key' => 'validation.recaptcha',
|
'error_message_key' => 'validation.recaptcha',
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* g-recaptcha tag attributes and grecaptcha.render parameters (v2 only)
|
* g-recaptcha tag attributes and grecaptcha.render parameters (v2 only)
|
||||||
|
*
|
||||||
* @see https://developers.google.com/recaptcha/docs/display#render_param
|
* @see https://developers.google.com/recaptcha/docs/display#render_param
|
||||||
* @since v4.0.0
|
* @since v4.0.0
|
||||||
*/
|
*/
|
||||||
@ -175,5 +158,5 @@
|
|||||||
* DO NOT SET "biscolabOnloadCallback"
|
* DO NOT SET "biscolabOnloadCallback"
|
||||||
*/
|
*/
|
||||||
'error-callback' => null,
|
'error-callback' => null,
|
||||||
]
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Illuminate\Support\Facades\Schema;
|
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
class CreateActivityLogTable extends Migration
|
class CreateActivityLogTable extends Migration
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Illuminate\Support\Facades\Schema;
|
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
class AddEventColumnToActivityLogTable extends Migration
|
class AddEventColumnToActivityLogTable extends Migration
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Illuminate\Support\Facades\Schema;
|
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
class AddBatchUuidColumnToActivityLogTable extends Migration
|
class AddBatchUuidColumnToActivityLogTable extends Migration
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace Database\Seeders;
|
namespace Database\Seeders;
|
||||||
|
|
||||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
class AiringProofThemeSeeder extends Seeder
|
class AiringProofThemeSeeder extends Seeder
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace Database\Seeders;
|
namespace Database\Seeders;
|
||||||
|
|
||||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
class AnnouncementSeeder extends Seeder
|
class AnnouncementSeeder extends Seeder
|
||||||
|
|||||||
@ -4,10 +4,7 @@
|
|||||||
|
|
||||||
use App\Models\Classification;
|
use App\Models\Classification;
|
||||||
use App\Models\Legacy\OldClassification;
|
use App\Models\Legacy\OldClassification;
|
||||||
use Carbon\Carbon;
|
|
||||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
use Illuminate\Support\Str;
|
|
||||||
|
|
||||||
class ClassificationSeeder extends Seeder
|
class ClassificationSeeder extends Seeder
|
||||||
{
|
{
|
||||||
|
|||||||
@ -4,9 +4,7 @@
|
|||||||
|
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
use App\Models\Legacy\OldCompany;
|
use App\Models\Legacy\OldCompany;
|
||||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
use Illuminate\Support\Facades\Log;
|
|
||||||
|
|
||||||
class CompanySeeder extends Seeder
|
class CompanySeeder extends Seeder
|
||||||
{
|
{
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user