Posts

How to use Costom Library in laravel

Route: Route :: group ([ 'prefix' => '' , 'namespace' => 'Front' ] , function (){ Route :: get ( '/' , 'NewsController@index' ); }); Controller : <?php namespace App\Http\Controllers\Front ; use App\Http\Controllers\Controller ; use App\Library\API\News_Api ; use Illuminate\Http\Request ; class NewsController extends Controller { public function index (){ $news_details = []; $news = ( new News_Api ())-> News_get ( $news_details ); dd ( $news ); } } Library : <?php namespace App\Library\API ; use GuzzleHttp\Client ; class News_Api { function News_get ( $news_details ){ $news = ( new Client ())-> request ( 'GET' , env ( 'NEWS_BASE_URL' ) ,[ 'query' => [ 'query1' => '' ] ]); return json_decode ((string) $news -> getBody ()); } }

crud operation in codeigniter

Download File Controller: function subitem(){ if($this->session->userdata('username')){ $id=$this->uri->segment(3); if($this->input->post('Submit')){ $data=array( 'subitem_itemname'=>$this->input->post('miname'), );//print_r($data);die();   $this->Item_model->insert_subitem($data); }elseif($this->input->post('Update')){ $data=array( 'subitem_id'=>$this->input->post('subitem_id'), 'subitem_itemname'=>$this->input->post('miname'), ); //print_r($data);die(); $this->Item_model->update_subitem($data); }elseif($id){ $data=array( 'subitem_id'=>$id, 'subitem_active'=>0 ); $this->Item_model->delete_subitem($data); } $data['view_item']=$this->Item_model->view_item(); $data['view_itemoption'

Push Notification in Android using Firebase (FCM) and PHP

Creating PHP Project 1.  Start WAMP/XAMPP server and navigate to  www  or  htdocs  folder and create a folder named  firebase  inside it. Inside this folder, create a subfolder called  notifications 2.  Now create a file named  notification.php  inside  notifications  folder. This will have Notification class which will help in constructing the notification data payload. notification.php PHP 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 <?php class Notification { private $title ; private $message ; private $image_url ; private $action ; private $action_destination ; private $data ; function __construct ( ) {          } public function setTitle ( $title ) { $this -> title = $title ; } public functi